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 TaskContext
public AnyMap getTaskParameters()
getTaskParameters
in interface TaskContext
public Inputs getInputs()
getInputs
in interface TaskContext
public Outputs getOutputs()
getOutputs
in interface TaskContext
public java.util.Map<java.lang.String,java.lang.Number> getFinalCounters()
getFinalCounters
in interface TaskContext
public void addToCounter(java.lang.String name, long value)
TaskContext
addToCounter
in interface TaskContext
name
- the name of the countervalue
- the value to add to the counterpublic void addToCounter(java.lang.String name, double value)
TaskContext
addToCounter
in interface TaskContext
name
- the name of the countervalue
- the value to add to the counterpublic long getTimestamp()
getTimestamp
in interface TaskContext
TaskContext.measureTime(String, long)
to measure a duration.public void measureTime(java.lang.String name, long startTime)
TaskContext
measureTime
in interface TaskContext
name
- the name of the counterstartTime
- the start timepublic void addDuration(java.lang.String name, long duration)
TaskContext
addDuration
in interface TaskContext
name
- the name of the counterduration
- the duration in nanoseconds to add.public void addDuration(java.lang.String name, double duration)
TaskContext
addDuration
in interface TaskContext
name
- the name of the counterduration
- the duration in seconds to add.public boolean isCanceled()
isCanceled
in interface TaskContext
true
if current task is canceled, false
otherwise.public void cancel()
cancel
in interface TaskContext
public ObjectStoreService getObjectStore()
getObjectStore
in interface TaskContext
public TaskLog getLog()
getLog
in interface TaskContext