public class ImmediateExecutor extends AbstractExecutor implements IExecutor, IRunnableExecutor
Executes IProgressRunnable instances immediately.
NOTE: execute(IProgressRunnable, IProgressMonitor) should be
used with some degree of caution with this implementation, as unlike other
implementations the IProgressRunnable.run(IProgressMonitor) method
will be called by the thread that calls
execute(IProgressRunnable, IProgressMonitor), meaning that calling
#execute(IProgressRunnable, IProgressMonitor) may block the calling thread
indefinitely.
ThreadsExecutor| Constructor and Description |
|---|
ImmediateExecutor() |
| Modifier and Type | Method and Description |
|---|---|
protected AbstractFuture<?> |
createFuture(IProgressMonitor monitor)
Create an
AbstractFuture instance. |
<ResultType> |
execute(IProgressRunnable<? extends ResultType> runnable,
IProgressMonitor monitor)
Execute the given
IProgressRunnable (i.e. call
IProgressRunnable.run(IProgressMonitor). |
executeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexecuteprotected AbstractFuture<?> createFuture(IProgressMonitor monitor)
AbstractExecutorAbstractFuture instance. Subclasses must override to
define the concrete type of future to return from
AbstractExecutor.execute(IProgressRunnable, IProgressMonitor).createFuture in class AbstractExecutormonitor - any progress monitor to provide to the future upon
construction. May be null.public <ResultType> IFuture<ResultType> execute(IProgressRunnable<? extends ResultType> runnable, IProgressMonitor monitor)
IExecutor
Execute the given IProgressRunnable (i.e. call
IProgressRunnable.run(IProgressMonitor). Will return a non-
null instance of IFuture that allows clients to
inspect the state of the execution and retrieve any results via
IFuture.get() or IFuture.get(long).
Note that implementers may decide whether to invoke
IProgressRunnable.run(IProgressMonitor) asynchronously or
synchronously, but since IProgressRunnables are frequently going to be
longer-running operations, implementers should proceed carefully before
implementing with synchronous (blocking) invocation. Implementers should
typically implement via some non-blocking asynchronous invocation
mechanism, e.g. Threads, Jobs, ThreadPools etc.
execute in interface IExecutorexecute in class AbstractExecutorResultType - the type that will be returned by the
IProgressRunnable as well as the returned
IFuturerunnable - the IProgressRunnable to invoke. Must not be
null.monitor - any IProgressMonitor to be passed to the runnable. May
be null.IFuture to allow for inspection of the state of the
computation by clients, as well as access to any return values of
IProgressRunnable.run(IProgressMonitor). Will not be
null.