public class TaskContextImpl extends java.lang.Object implements TaskContext
| Constructor and Description |
|---|
TaskContextImpl(Task task,
TaskLog taskLog,
ObjectStoreService objectStore)
create instance.
|
TaskContextImpl(Task task,
TaskLog taskLog,
ObjectStoreService objectStore,
java.util.Map<java.lang.String,java.util.Collection<OutputMode>> outputModes)
create instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDuration(java.lang.String name,
double duration)
On each call, the value is added to the existing duration value for the given name.
|
void |
addDuration(java.lang.String name,
long duration)
On each call, the value is added to the existing duration value for the given name.
|
void |
addToCounter(java.lang.String name,
double value)
On each call, the value is added to the existing counter value for the given name.
|
void |
addToCounter(java.lang.String name,
long value)
On each call, the value is added to the existing counter value for the given name.
|
void |
cancel()
cancel task execution.
|
java.util.Map<java.lang.String,java.lang.Number> |
getFinalCounters() |
Inputs |
getInputs() |
TaskLog |
getLog() |
ObjectStoreService |
getObjectStore() |
Outputs |
getOutputs() |
Task |
getTask() |
AnyMap |
getTaskParameters() |
long |
getTimestamp() |
boolean |
isCanceled() |
void |
measureTime(java.lang.String name,
long startTime)
measure time that has elapsed since the startTime value and add the duration to the named counter.
|
public TaskContextImpl(Task task, TaskLog taskLog, ObjectStoreService objectStore)
public TaskContextImpl(Task task, TaskLog taskLog, ObjectStoreService objectStore, java.util.Map<java.lang.String,java.util.Collection<OutputMode>> outputModes)
public Task getTask()
getTask in interface TaskContextpublic AnyMap getTaskParameters()
getTaskParameters in interface TaskContextpublic Inputs getInputs()
getInputs in interface TaskContextpublic Outputs getOutputs()
getOutputs in interface TaskContextpublic java.util.Map<java.lang.String,java.lang.Number> getFinalCounters()
getFinalCounters in interface TaskContextpublic void addToCounter(java.lang.String name,
long value)
TaskContextaddToCounter in interface TaskContextname - the name of the countervalue - the value to add to the counterpublic void addToCounter(java.lang.String name,
double value)
TaskContextaddToCounter in interface TaskContextname - the name of the countervalue - the value to add to the counterpublic long getTimestamp()
getTimestamp in interface TaskContextTaskContext.measureTime(String, long) to measure a duration.public void measureTime(java.lang.String name,
long startTime)
TaskContextmeasureTime in interface TaskContextname - the name of the counterstartTime - the start timepublic void addDuration(java.lang.String name,
long duration)
TaskContextaddDuration in interface TaskContextname - the name of the counterduration - the duration in nanoseconds to add.public void addDuration(java.lang.String name,
double duration)
TaskContextaddDuration in interface TaskContextname - the name of the counterduration - the duration in seconds to add.public boolean isCanceled()
isCanceled in interface TaskContexttrue if current task is canceled, false otherwise.public void cancel()
cancel in interface TaskContextpublic ObjectStoreService getObjectStore()
getObjectStore in interface TaskContextpublic TaskLog getLog()
getLog in interface TaskContext