er.extensions.concurrency
Class ERXFutureTask<V>
java.lang.Object
java.util.concurrent.FutureTask<V>
er.extensions.concurrency.ERXFutureTask<V>
- All Implemented Interfaces:
- com.webobjects.foundation.NSKeyValueCoding, ERXExecutionStateTransition, ERXTaskPercentComplete, ERXStatusInterface, java.lang.Runnable, java.util.concurrent.Future<V>, java.util.concurrent.RunnableFuture<V>
public class ERXFutureTask<V>
- extends java.util.concurrent.FutureTask<V>
- implements ERXExecutionStateTransition, ERXStatusInterface, ERXTaskPercentComplete, com.webobjects.foundation.NSKeyValueCoding
A FutureTask that implements @link ERXStatusInterface
and @link
ERXTaskPercentComplete
and @link NSKeyValueCoding
. Additional
methods are provided in this FutureTask for checking if those interfaces are
implemented in the wrapped task and if so the values are
passed thru from the task.
Usage:
// If null, then submit the callable task
ERXFutureTask _future = new ERXFutureTask(callable);
ERXExecutorService.executorService().execute(_future);
- Author:
- kieran
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSKeyValueCoding |
com.webobjects.foundation.NSKeyValueCoding._BooleanFieldBinding, com.webobjects.foundation.NSKeyValueCoding._BooleanMethodBinding, com.webobjects.foundation.NSKeyValueCoding._FieldBinding, com.webobjects.foundation.NSKeyValueCoding._ForwardingBinding, com.webobjects.foundation.NSKeyValueCoding._KeyBinding, com.webobjects.foundation.NSKeyValueCoding._KeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding._MethodBinding, com.webobjects.foundation.NSKeyValueCoding._NumberFieldBinding, com.webobjects.foundation.NSKeyValueCoding._NumberMethodBinding, com.webobjects.foundation.NSKeyValueCoding._ReflectionKeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding.DefaultImplementation, com.webobjects.foundation.NSKeyValueCoding.ErrorHandling, com.webobjects.foundation.NSKeyValueCoding.Null, com.webobjects.foundation.NSKeyValueCoding.UnknownKeyException, com.webobjects.foundation.NSKeyValueCoding.Utility, com.webobjects.foundation.NSKeyValueCoding.ValueAccessor |
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding |
_CLASS, NullValue |
Methods inherited from class java.util.concurrent.FutureTask |
cancel, done, get, get, isCancelled, isDone, run, runAndReset, set, setException |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ERXFutureTask
public ERXFutureTask(java.util.concurrent.Callable<V> callable)
ERXFutureTask
public ERXFutureTask(java.lang.Runnable runnable,
V result)
task
public java.lang.Object task()
status
public java.lang.String status()
- Specified by:
status
in interface ERXStatusInterface
- Returns:
- the status of a task. Useful for a long running task to implement an optional status message.
percentComplete
public java.lang.Double percentComplete()
- Specified by:
percentComplete
in interface ERXTaskPercentComplete
- Returns:
- a Double between 0 and 1.0 indicating how far a task has progressed toward completion. A null return value
indicates that percent complete is unknown
takeValueForKey
public void takeValueForKey(java.lang.Object value,
java.lang.String key)
- Specified by:
takeValueForKey
in interface com.webobjects.foundation.NSKeyValueCoding
valueForKey
public java.lang.Object valueForKey(java.lang.String key)
- Specified by:
valueForKey
in interface com.webobjects.foundation.NSKeyValueCoding
hasStatus
public boolean hasStatus()
- Returns:
- whether the wrapped task has @link
ERXStatusInterface
interface
isStoppable
public boolean isStoppable()
- Returns:
- true if the task bound to this Future implements the
IERXStoppable
interface
hasPercentComplete
public boolean hasPercentComplete()
- Returns:
- whether the wrapped task has @link
ERXTaskPercentComplete
interface
afterExecute
public void afterExecute()
- Specified by:
afterExecute
in interface ERXExecutionStateTransition
beforeExecute
public void beforeExecute()
- Specified by:
beforeExecute
in interface ERXExecutionStateTransition
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
Copyright © 2002 – 2007 Project Wonder.