Package org.threadly.concurrent.wrapper
Class ThrowableSuppressingRunnable
- java.lang.Object
-
- org.threadly.concurrent.wrapper.ThrowableSuppressingRunnable
-
- All Implemented Interfaces:
java.lang.Runnable
,RunnableContainer
public class ThrowableSuppressingRunnable extends java.lang.Object implements RunnableContainer, java.lang.Runnable
Class that is designed to wrap a runnable, and prevent any throwables from propagating out of the run function. If a throwable is thrown, it will be provided toExceptionUtils.handleException(Throwable)
.- Since:
- 4.6.0 (since 2.3.0 at org.threadly.concurrent)
-
-
Constructor Summary
Constructors Constructor Description ThrowableSuppressingRunnable(java.lang.Runnable task)
Constructs a new ThrowableSurpressingRunnable with the provided task.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Runnable
getContainedRunnable()
Call to get the contained runnable within the wrapper.void
run()
-
-
-
Constructor Detail
-
ThrowableSuppressingRunnable
public ThrowableSuppressingRunnable(java.lang.Runnable task)
Constructs a new ThrowableSurpressingRunnable with the provided task. If the task isnull
, when this is run no operation will occur.- Parameters:
task
- task to be executed and have exceptions prevented from being thrown
-
-
Method Detail
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
-
getContainedRunnable
public java.lang.Runnable getContainedRunnable()
Description copied from interface:RunnableContainer
Call to get the contained runnable within the wrapper.- Specified by:
getContainedRunnable
in interfaceRunnableContainer
- Returns:
- runnable contained, or
null
if none is contained
-
-