public interface IExecutor
Contract for the actual execution of IProgressRunnables. Instances of
this interface must be able to provide resources to eventually execute a
given IProgressRunnable, upon calling
execute(IProgressRunnable, IProgressMonitor).
Note that implementations may decide what/how to execute the given
IProgressRunnable (i.e. via a Thread, or a Job, or a ThreadPool or
some other invocation mechanism. But the intended contract of
execute(IProgressRunnable, IProgressMonitor) is that the
IProgressRunnable.run(IProgressMonitor) method will be invoked by
this executor in a timely manner without blocking.
IProgressRunnable,
IFuture,
execute(IProgressRunnable, IProgressMonitor)| Modifier and Type | Method and Description |
|---|---|
<ResultType> |
execute(IProgressRunnable<? extends ResultType> runnable,
IProgressMonitor monitor)
Execute the given
IProgressRunnable (i.e. call
IProgressRunnable.run(IProgressMonitor). |
<ResultType> IFuture<ResultType> execute(IProgressRunnable<? extends ResultType> runnable, IProgressMonitor monitor)
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.
ResultType - 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.