public class SingleThreadedScheduler extends java.lang.Object implements TaskScheduler, CanSetName
Task
s execute with in-order
single-threaded semantics.
Tasks can be presented through submit(Callable)
. The order of execution is the
sumbission order.
This implementation does so by blocking on a ConcurrentLinkedQueue
, after
the task is started in a thread (and Task.isBegun()
returns true), but (of course)
before the TaskInternal.getJob()
actually gets invoked.
Constructor and Description |
---|
SingleThreadedScheduler() |
Modifier and Type | Method and Description |
---|---|
void |
injectExecutor(java.util.concurrent.ExecutorService executor) |
void |
setName(java.lang.String name) |
<T> java.util.concurrent.Future<T> |
submit(java.util.concurrent.Callable<T> c)
Called by
BasicExecutionManager to schedule tasks. |
java.lang.String |
toString() |
public void setName(java.lang.String name)
setName
in interface CanSetName
public java.lang.String toString()
toString
in class java.lang.Object
public void injectExecutor(java.util.concurrent.ExecutorService executor)
injectExecutor
in interface TaskScheduler
public <T> java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T> c)
TaskScheduler
BasicExecutionManager
to schedule tasks.submit
in interface TaskScheduler