Fixed logs that come from threads.

Contributed by Sahar.
This commit is contained in:
MobiusDevelopment 2019-10-04 08:31:36 +00:00
parent 9a6ad96ed0
commit 81a0e074e7
16 changed files with 128 additions and 112 deletions

View File

@ -16,17 +16,13 @@
*/
package org.l2jmobius.commons.concurrent;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import java.lang.Thread.UncaughtExceptionHandler;
/**
* @author Mobius
*/
public class RunnableWrapper implements Runnable
{
private static final Logger LOGGER = Logger.getLogger(RunnableWrapper.class.getName());
private final Runnable _runnable;
public RunnableWrapper(Runnable runnable)
@ -41,9 +37,14 @@ public class RunnableWrapper implements Runnable
{
_runnable.run();
}
catch (Exception e)
catch (Throwable e)
{
LOGGER.warning(e.getMessage() + Config.EOL + e.getStackTrace());
final Thread t = Thread.currentThread();
final UncaughtExceptionHandler h = t.getUncaughtExceptionHandler();
if (h != null)
{
h.uncaughtException(t, e);
}
}
}
}

View File

@ -16,17 +16,13 @@
*/
package org.l2jmobius.commons.concurrent;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import java.lang.Thread.UncaughtExceptionHandler;
/**
* @author Mobius
*/
public class RunnableWrapper implements Runnable
{
private static final Logger LOGGER = Logger.getLogger(RunnableWrapper.class.getName());
private final Runnable _runnable;
public RunnableWrapper(Runnable runnable)
@ -41,9 +37,14 @@ public class RunnableWrapper implements Runnable
{
_runnable.run();
}
catch (Exception e)
catch (Throwable e)
{
LOGGER.warning(e.getMessage() + Config.EOL + e.getStackTrace());
final Thread t = Thread.currentThread();
final UncaughtExceptionHandler h = t.getUncaughtExceptionHandler();
if (h != null)
{
h.uncaughtException(t, e);
}
}
}
}

View File

@ -16,17 +16,13 @@
*/
package org.l2jmobius.commons.concurrent;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import java.lang.Thread.UncaughtExceptionHandler;
/**
* @author Mobius
*/
public class RunnableWrapper implements Runnable
{
private static final Logger LOGGER = Logger.getLogger(RunnableWrapper.class.getName());
private final Runnable _runnable;
public RunnableWrapper(Runnable runnable)
@ -41,9 +37,14 @@ public class RunnableWrapper implements Runnable
{
_runnable.run();
}
catch (Exception e)
catch (Throwable e)
{
LOGGER.warning(e.getMessage() + Config.EOL + e.getStackTrace());
final Thread t = Thread.currentThread();
final UncaughtExceptionHandler h = t.getUncaughtExceptionHandler();
if (h != null)
{
h.uncaughtException(t, e);
}
}
}
}

View File

@ -16,17 +16,13 @@
*/
package org.l2jmobius.commons.concurrent;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import java.lang.Thread.UncaughtExceptionHandler;
/**
* @author Mobius
*/
public class RunnableWrapper implements Runnable
{
private static final Logger LOGGER = Logger.getLogger(RunnableWrapper.class.getName());
private final Runnable _runnable;
public RunnableWrapper(Runnable runnable)
@ -41,9 +37,14 @@ public class RunnableWrapper implements Runnable
{
_runnable.run();
}
catch (Exception e)
catch (Throwable e)
{
LOGGER.warning(e.getMessage() + Config.EOL + e.getStackTrace());
final Thread t = Thread.currentThread();
final UncaughtExceptionHandler h = t.getUncaughtExceptionHandler();
if (h != null)
{
h.uncaughtException(t, e);
}
}
}
}

View File

@ -16,17 +16,13 @@
*/
package org.l2jmobius.commons.concurrent;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import java.lang.Thread.UncaughtExceptionHandler;
/**
* @author Mobius
*/
public class RunnableWrapper implements Runnable
{
private static final Logger LOGGER = Logger.getLogger(RunnableWrapper.class.getName());
private final Runnable _runnable;
public RunnableWrapper(Runnable runnable)
@ -41,9 +37,14 @@ public class RunnableWrapper implements Runnable
{
_runnable.run();
}
catch (Exception e)
catch (Throwable e)
{
LOGGER.warning(e.getMessage() + Config.EOL + e.getStackTrace());
final Thread t = Thread.currentThread();
final UncaughtExceptionHandler h = t.getUncaughtExceptionHandler();
if (h != null)
{
h.uncaughtException(t, e);
}
}
}
}

View File

@ -16,17 +16,13 @@
*/
package org.l2jmobius.commons.concurrent;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import java.lang.Thread.UncaughtExceptionHandler;
/**
* @author Mobius
*/
public class RunnableWrapper implements Runnable
{
private static final Logger LOGGER = Logger.getLogger(RunnableWrapper.class.getName());
private final Runnable _runnable;
public RunnableWrapper(Runnable runnable)
@ -41,9 +37,14 @@ public class RunnableWrapper implements Runnable
{
_runnable.run();
}
catch (Exception e)
catch (Throwable e)
{
LOGGER.warning(e.getMessage() + Config.EOL + e.getStackTrace());
final Thread t = Thread.currentThread();
final UncaughtExceptionHandler h = t.getUncaughtExceptionHandler();
if (h != null)
{
h.uncaughtException(t, e);
}
}
}
}

View File

@ -16,17 +16,13 @@
*/
package org.l2jmobius.commons.concurrent;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import java.lang.Thread.UncaughtExceptionHandler;
/**
* @author Mobius
*/
public class RunnableWrapper implements Runnable
{
private static final Logger LOGGER = Logger.getLogger(RunnableWrapper.class.getName());
private final Runnable _runnable;
public RunnableWrapper(Runnable runnable)
@ -41,9 +37,14 @@ public class RunnableWrapper implements Runnable
{
_runnable.run();
}
catch (Exception e)
catch (Throwable e)
{
LOGGER.warning(e.getMessage() + Config.EOL + e.getStackTrace());
final Thread t = Thread.currentThread();
final UncaughtExceptionHandler h = t.getUncaughtExceptionHandler();
if (h != null)
{
h.uncaughtException(t, e);
}
}
}
}

View File

@ -16,17 +16,13 @@
*/
package org.l2jmobius.commons.concurrent;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import java.lang.Thread.UncaughtExceptionHandler;
/**
* @author Mobius
*/
public class RunnableWrapper implements Runnable
{
private static final Logger LOGGER = Logger.getLogger(RunnableWrapper.class.getName());
private final Runnable _runnable;
public RunnableWrapper(Runnable runnable)
@ -41,9 +37,14 @@ public class RunnableWrapper implements Runnable
{
_runnable.run();
}
catch (Exception e)
catch (Throwable e)
{
LOGGER.warning(e.getMessage() + Config.EOL + e.getStackTrace());
final Thread t = Thread.currentThread();
final UncaughtExceptionHandler h = t.getUncaughtExceptionHandler();
if (h != null)
{
h.uncaughtException(t, e);
}
}
}
}

View File

@ -16,17 +16,13 @@
*/
package org.l2jmobius.commons.concurrent;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import java.lang.Thread.UncaughtExceptionHandler;
/**
* @author Mobius
*/
public class RunnableWrapper implements Runnable
{
private static final Logger LOGGER = Logger.getLogger(RunnableWrapper.class.getName());
private final Runnable _runnable;
public RunnableWrapper(Runnable runnable)
@ -41,9 +37,14 @@ public class RunnableWrapper implements Runnable
{
_runnable.run();
}
catch (Exception e)
catch (Throwable e)
{
LOGGER.warning(e.getMessage() + Config.EOL + e.getStackTrace());
final Thread t = Thread.currentThread();
final UncaughtExceptionHandler h = t.getUncaughtExceptionHandler();
if (h != null)
{
h.uncaughtException(t, e);
}
}
}
}

View File

@ -16,17 +16,13 @@
*/
package org.l2jmobius.commons.concurrent;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import java.lang.Thread.UncaughtExceptionHandler;
/**
* @author Mobius
*/
public class RunnableWrapper implements Runnable
{
private static final Logger LOGGER = Logger.getLogger(RunnableWrapper.class.getName());
private final Runnable _runnable;
public RunnableWrapper(Runnable runnable)
@ -41,9 +37,14 @@ public class RunnableWrapper implements Runnable
{
_runnable.run();
}
catch (Exception e)
catch (Throwable e)
{
LOGGER.warning(e.getMessage() + Config.EOL + e.getStackTrace());
final Thread t = Thread.currentThread();
final UncaughtExceptionHandler h = t.getUncaughtExceptionHandler();
if (h != null)
{
h.uncaughtException(t, e);
}
}
}
}

View File

@ -16,17 +16,13 @@
*/
package org.l2jmobius.commons.concurrent;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import java.lang.Thread.UncaughtExceptionHandler;
/**
* @author Mobius
*/
public class RunnableWrapper implements Runnable
{
private static final Logger LOGGER = Logger.getLogger(RunnableWrapper.class.getName());
private final Runnable _runnable;
public RunnableWrapper(Runnable runnable)
@ -41,9 +37,14 @@ public class RunnableWrapper implements Runnable
{
_runnable.run();
}
catch (Exception e)
catch (Throwable e)
{
LOGGER.warning(e.getMessage() + Config.EOL + e.getStackTrace());
final Thread t = Thread.currentThread();
final UncaughtExceptionHandler h = t.getUncaughtExceptionHandler();
if (h != null)
{
h.uncaughtException(t, e);
}
}
}
}

View File

@ -16,17 +16,13 @@
*/
package org.l2jmobius.commons.concurrent;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import java.lang.Thread.UncaughtExceptionHandler;
/**
* @author Mobius
*/
public class RunnableWrapper implements Runnable
{
private static final Logger LOGGER = Logger.getLogger(RunnableWrapper.class.getName());
private final Runnable _runnable;
public RunnableWrapper(Runnable runnable)
@ -41,9 +37,14 @@ public class RunnableWrapper implements Runnable
{
_runnable.run();
}
catch (Exception e)
catch (Throwable e)
{
LOGGER.warning(e.getMessage() + Config.EOL + e.getStackTrace());
final Thread t = Thread.currentThread();
final UncaughtExceptionHandler h = t.getUncaughtExceptionHandler();
if (h != null)
{
h.uncaughtException(t, e);
}
}
}
}

View File

@ -16,17 +16,13 @@
*/
package org.l2jmobius.commons.concurrent;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import java.lang.Thread.UncaughtExceptionHandler;
/**
* @author Mobius
*/
public class RunnableWrapper implements Runnable
{
private static final Logger LOGGER = Logger.getLogger(RunnableWrapper.class.getName());
private final Runnable _runnable;
public RunnableWrapper(Runnable runnable)
@ -41,9 +37,14 @@ public class RunnableWrapper implements Runnable
{
_runnable.run();
}
catch (Exception e)
catch (Throwable e)
{
LOGGER.warning(e.getMessage() + Config.EOL + e.getStackTrace());
final Thread t = Thread.currentThread();
final UncaughtExceptionHandler h = t.getUncaughtExceptionHandler();
if (h != null)
{
h.uncaughtException(t, e);
}
}
}
}

View File

@ -16,17 +16,13 @@
*/
package org.l2jmobius.commons.concurrent;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import java.lang.Thread.UncaughtExceptionHandler;
/**
* @author Mobius
*/
public class RunnableWrapper implements Runnable
{
private static final Logger LOGGER = Logger.getLogger(RunnableWrapper.class.getName());
private final Runnable _runnable;
public RunnableWrapper(Runnable runnable)
@ -41,9 +37,14 @@ public class RunnableWrapper implements Runnable
{
_runnable.run();
}
catch (Exception e)
catch (Throwable e)
{
LOGGER.warning(e.getMessage() + Config.EOL + e.getStackTrace());
final Thread t = Thread.currentThread();
final UncaughtExceptionHandler h = t.getUncaughtExceptionHandler();
if (h != null)
{
h.uncaughtException(t, e);
}
}
}
}

View File

@ -16,17 +16,13 @@
*/
package org.l2jmobius.commons.concurrent;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import java.lang.Thread.UncaughtExceptionHandler;
/**
* @author Mobius
*/
public class RunnableWrapper implements Runnable
{
private static final Logger LOGGER = Logger.getLogger(RunnableWrapper.class.getName());
private final Runnable _runnable;
public RunnableWrapper(Runnable runnable)
@ -41,9 +37,14 @@ public class RunnableWrapper implements Runnable
{
_runnable.run();
}
catch (Exception e)
catch (Throwable e)
{
LOGGER.warning(e.getMessage() + Config.EOL + e.getStackTrace());
final Thread t = Thread.currentThread();
final UncaughtExceptionHandler h = t.getUncaughtExceptionHandler();
if (h != null)
{
h.uncaughtException(t, e);
}
}
}
}

View File

@ -16,17 +16,13 @@
*/
package org.l2jmobius.commons.concurrent;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import java.lang.Thread.UncaughtExceptionHandler;
/**
* @author Mobius
*/
public class RunnableWrapper implements Runnable
{
private static final Logger LOGGER = Logger.getLogger(RunnableWrapper.class.getName());
private final Runnable _runnable;
public RunnableWrapper(Runnable runnable)
@ -41,9 +37,14 @@ public class RunnableWrapper implements Runnable
{
_runnable.run();
}
catch (Exception e)
catch (Throwable e)
{
LOGGER.warning(e.getMessage() + Config.EOL + e.getStackTrace());
final Thread t = Thread.currentThread();
final UncaughtExceptionHandler h = t.getUncaughtExceptionHandler();
if (h != null)
{
h.uncaughtException(t, e);
}
}
}
}