org.eclipse.ecf.core.util
Class ThreadsExecutor

java.lang.Object
  extended by org.eclipse.ecf.core.util.AbstractExecutor
      extended by org.eclipse.ecf.core.util.ThreadsExecutor
All Implemented Interfaces:
IExecutor, IRunnableExecutor

public class ThreadsExecutor
extends AbstractExecutor


Constructor Summary
ThreadsExecutor()
           
 
Method Summary
 void configureThreadForExecution(java.lang.Thread t)
           
protected  AbstractFuture createFuture(org.eclipse.core.runtime.IProgressMonitor monitor)
           
protected  java.lang.Runnable createRunnable(ISafeProgressRunner sof, IProgressRunnable progressRunnable)
           
protected  java.lang.String createThreadName(IProgressRunnable runnable)
           
 IFuture execute(IProgressRunnable runnable, org.eclipse.core.runtime.IProgressMonitor monitor)
           Execute the given IProgressRunnable (i.e.
 
Methods inherited from class org.eclipse.ecf.core.util.AbstractExecutor
execute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadsExecutor

public ThreadsExecutor()
Method Detail

createThreadName

protected java.lang.String createThreadName(IProgressRunnable runnable)

createRunnable

protected java.lang.Runnable createRunnable(ISafeProgressRunner sof,
                                            IProgressRunnable progressRunnable)

configureThreadForExecution

public void configureThreadForExecution(java.lang.Thread t)

createFuture

protected AbstractFuture createFuture(org.eclipse.core.runtime.IProgressMonitor monitor)
Specified by:
createFuture in class AbstractExecutor

execute

public IFuture execute(IProgressRunnable runnable,
                       org.eclipse.core.runtime.IProgressMonitor monitor)
                throws java.lang.IllegalThreadStateException
Description copied from interface: 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.

Specified by:
execute in interface IExecutor
Specified by:
execute in class AbstractExecutor
Parameters:
runnable - the IProgressRunnable to invoke. Must not be null.
monitor - any IProgressMonitor to be passed to the runnable. May be null.
Returns:
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.
Throws:
java.lang.IllegalThreadStateException