public class SafeRunnable extends Object implements Runnable
Runnable implementation that is safe to submit to an executor
or Scheduler.
When this implementation's run() method is invoked, it will set
the name of the current thread to the name passed to SafeRunnable,
run the wrapped runnable and finally restore the initial thread name.
When the wrapped runnable throws any unhandled exception, this exception
is logged at error level and the exception is re-thrown.
| Constructor and Description |
|---|
SafeRunnable(String name,
Runnable runnable)
New instance with the given
name wrapping the passed runnable. |
Copyright © 2012-2017 The Apache Software Foundation. All Rights Reserved.