public abstract class AbstractSubmitterExecutor extends java.lang.Object implements SubmitterExecutor
SubmitterExecutor
from an executor is often the same (just
using the ListenableFutureTask
to wrap the task). This class provides an easy way to
create a SubmitterExecutor
. Take a look at
SubmitterExecutorAdapter
for an easy example of how
this is used. In general this wont be useful outside of Threadly developers, but must be a
public visibility since it is used in sub-packages.
If you do find yourself using this class, please post an issue on github to tell us why. If there is something you want our schedulers to provide, we are happy to hear about it.
Constructor and Description |
---|
AbstractSubmitterExecutor() |
Modifier and Type | Method and Description |
---|---|
void |
execute(java.lang.Runnable task) |
<T> ListenableFuture<T> |
submit(java.util.concurrent.Callable<T> task)
Submit a
Callable to run as soon as possible. |
<T> ListenableFuture<T> |
submit(java.lang.Runnable task,
T result)
Submit a task to run as soon as possible.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
submit
public void execute(java.lang.Runnable task)
execute
in interface java.util.concurrent.Executor
public <T> ListenableFuture<T> submit(java.lang.Runnable task, T result)
SubmitterExecutor
Future.get()
method will
return the provided result once the runnable has completed.submit
in interface SubmitterExecutor
T
- type of result for futuretask
- runnable to be executedresult
- result to be returned from resulting future .get() when runnable completespublic <T> ListenableFuture<T> submit(java.util.concurrent.Callable<T> task)
SubmitterExecutor
Callable
to run as soon as possible. This is needed when a result needs to
be consumed from the callable.submit
in interface SubmitterExecutor
T
- type of result returned from the futuretask
- callable to be executed