T - the type of the result stored in the returned ExecutionResult
objectpublic abstract class StepTask<T> extends java.lang.Object implements java.util.concurrent.Callable<ExecutionResult<T>>, java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
protected StepTaskCallback<T> |
m_callback
Optional callback to invoke after the processing is complete
|
protected CallbackNotifierDelegate |
m_callbackNotifier
The callback notifier delegate.
|
protected LogManager |
m_log
The log to use
|
protected boolean |
m_mustRunSingleThreaded
True if only one of these tasks can be executing at any one time in the
Knowledge Flow/JVM.
|
protected boolean |
m_resourceIntensive
True if this is a high resource (cpu/memory) task
|
protected ExecutionResult<T> |
m_result
The result of executing the task - ready to be populated by subclass's
call() implementation
|
| Constructor and Description |
|---|
StepTask(Step source)
Constructor.
|
StepTask(Step source,
boolean resourceIntensive)
Constructor.
|
StepTask(Step source,
StepTaskCallback<T> callback)
Constructor with supplied callback.
|
StepTask(Step source,
StepTaskCallback<T> callback,
boolean resourceIntensive)
Constructor with supplied callback.
|
| Modifier and Type | Method and Description |
|---|---|
ExecutionResult<T> |
call()
Executor service calls this method to do the work
|
protected CallbackNotifierDelegate |
getCallbackNotifierDelegate()
Get the callback notifier delegate to use.
|
protected ExecutionResult<T> |
getExecutionResult()
Get the result of execution
|
protected LogManager |
getLogHandler()
Get the LogHandler to use for logging
|
boolean |
getMustRunSingleThreaded()
Get whether this
StepTask must run single threaded - i.e. only
one of these tasks is executing at any one time in the JVM. |
boolean |
isResourceIntensive()
Get whether this
StepTask is resource intensive (cpu/memory) or
not. |
protected void |
notifyCallback()
Notifies the registered callback (if any)
|
abstract void |
process()
The actual work gets done here.
|
protected void |
setCallbackNotifierDelegate(CallbackNotifierDelegate delegate)
Set the callback notifier delegate to use.
|
protected void |
setExecutionResult(ExecutionResult<T> execResult)
Set the result of execution
|
protected void |
setLogHandler(LogManager log)
Set the logger to use.
|
void |
setMustRunSingleThreaded(boolean singleThreaded)
Set whether this
StepTask must run single threaded - i.e. only
one of these tasks is executing at any one time in the JVM. |
void |
setResourceIntensive(boolean resourceIntensive)
Set whether this
StepTask is resource intensive (cpu/memory) or
not. |
protected ExecutionResult<T> m_result
protected transient StepTaskCallback<T> m_callback
protected LogManager m_log
protected boolean m_resourceIntensive
protected boolean m_mustRunSingleThreaded
protected CallbackNotifierDelegate m_callbackNotifier
public StepTask(Step source)
source - the source step producing this taskpublic StepTask(Step source, boolean resourceIntensive)
source - the source step producing this taskresourceIntensive - true if this task is cpu/memory intensivepublic StepTask(Step source, StepTaskCallback<T> callback)
source - the source step producing this taskcallback - the callback to usepublic StepTask(Step source, StepTaskCallback<T> callback, boolean resourceIntensive)
source - the source step producing this taskcallback - the callback to useresourceIntensive - true if this task is cpu/memory intensivepublic void setResourceIntensive(boolean resourceIntensive)
StepTask is resource intensive (cpu/memory) or
not. By default, a StepTask is resource intensiveresourceIntensive - false if this StepTask is not resource
intensivepublic boolean isResourceIntensive()
StepTask is resource intensive (cpu/memory) or
not. By default, a StepTask is resource intensiveStepTask is not resource intensivepublic void setMustRunSingleThreaded(boolean singleThreaded)
StepTask must run single threaded - i.e. only
one of these tasks is executing at any one time in the JVM. The Knowledge
Flow uses a special executor service with a single worker thread to execute
these tasks. This property, if true, overrides isResourceIntensive().singleThreaded - true if this task must run single threadedpublic boolean getMustRunSingleThreaded()
StepTask must run single threaded - i.e. only
one of these tasks is executing at any one time in the JVM. The Knowledge
Flow uses a special executor service with a single worker thread to execute
these tasks. This property, if true, overrides isResourceIntensive().protected final CallbackNotifierDelegate getCallbackNotifierDelegate()
protected final void setCallbackNotifierDelegate(CallbackNotifierDelegate delegate)
delegate - the delegate to useprotected final LogManager getLogHandler()
protected final void setLogHandler(LogManager log)
log - the log to useprotected final void notifyCallback()
throws java.lang.Exception
java.lang.Exception - if a problem occursprotected final ExecutionResult<T> getExecutionResult()
protected final void setExecutionResult(ExecutionResult<T> execResult)
execResult - the result of executionpublic ExecutionResult<T> call() throws java.lang.Exception
call in interface java.util.concurrent.Callable<ExecutionResult<T>>java.lang.Exceptionpublic abstract void process()
throws java.lang.Exception
java.lang.Exception