public class WrappedRunnable
extends java.lang.Object
implements java.lang.Runnable
If you have a Runnable
instance r you could wrap it with
code similar to the following snippet.
ExecutorService executor = Executors.newSingleThreadScheduledExecutor(); executor.submit(new WrappedRunnable(r));This would ensure that if an exception is thrown that it will be logged.
Constructor and Description |
---|
WrappedRunnable(java.lang.Runnable task)
Wraps the passed task and logs to
Logger.getAnonymousLogger() if
that task fails due to an unhandled exception. |
Modifier and Type | Method and Description |
---|---|
void |
run() |