T
- Type of result returnedpublic class RunnableCallableAdapter<T> extends java.lang.Object implements java.util.concurrent.Callable<T>, RunnableContainer
Runnable
with a result into a Callable
. This is similar to
Executors.callable(Runnable, Object)
, except this implementation
also implements the RunnableContainer
interface.Modifier and Type | Method and Description |
---|---|
static <T> java.util.concurrent.Callable<T> |
adapt(java.lang.Runnable runnable,
T result)
Adapt a
Runnable and result into a Callable . |
T |
call() |
java.lang.Runnable |
getContainedRunnable()
Call to get the contained runnable within the wrapper.
|
public static <T> java.util.concurrent.Callable<T> adapt(java.lang.Runnable runnable, T result)
Runnable
and result into a Callable
. The returned callable will
invoke Runnable.run()
then return the result provided to this function.T
- Type of result to be returned from provided Callable
runnable
- Runnable to be invoked when this adapter is ranresult
- Result to return from Callable or null
Callable
instance for invocationpublic java.lang.Runnable getContainedRunnable()
RunnableContainer
getContainedRunnable
in interface RunnableContainer
null
if none is contained