Class TaskRegistry.TaskData
java.lang.Object
de.iip_ecosphere.platform.support.TaskRegistry.TaskData
- Enclosing class:
TaskRegistry
Represents data associated to a task. The task data may require multiple task status changes to count as
TaskRegistry.TaskStatus.STOPPED. It may also count/compare a certain number of generic events.- Author:
- Holger Eichelberger, SSE
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate Stringprivate intprivate intprivate TaskRegistry.TaskStatusprivate intprivate longprivate long -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateCreates an instance, sets the id and turns the status toTaskRegistry.TaskStatus.RUNNING. -
Method Summary
Modifier and TypeMethodDescriptiongetId()Returns the task id.Returns the task status.intIncreases the event counter.booleanReturns whether the maximum number of (expected) events was already reached.booleanReturns whether the given taskdatais the same regarding the task id modulo beginning/trailing quotes asgetId().booleanReturns whether the giventaskIdmodulo beginning/trailing quotes is the same asgetId().voidsetMaxEventCount(int maxEventCount) Defines the maximum number of (expected) events.voidsetRequiredStopCalls(int requiredStopCalls) Changes the number of required stop calls (setStatus(TaskStatus)withTaskRegistry.TaskStatus.STOPPED) to change the task to stopped.private TaskRegistry.TaskDatasetStatus(TaskRegistry.TaskStatus status) Changes the task status and the timestamp of change.toString()
-
Field Details
-
id
-
threadId
private long threadId -
timestamp
private long timestamp -
status
-
requiredStopCalls
private int requiredStopCalls -
stopCallCount
private int stopCallCount -
maxEventCount
private int maxEventCount -
eventCount
private int eventCount
-
-
Constructor Details
-
TaskData
Creates an instance, sets the id and turns the status toTaskRegistry.TaskStatus.RUNNING.- Parameters:
taskId- a given task id, null for generate onethread- the thread to take for the thread id, may be null for the actual thread
-
-
Method Details
-
setStatus
Changes the task status and the timestamp of change.- Parameters:
status- the new status- Returns:
- this
-
setRequiredStopCalls
public void setRequiredStopCalls(int requiredStopCalls) Changes the number of required stop calls (setStatus(TaskStatus)withTaskRegistry.TaskStatus.STOPPED) to change the task to stopped. The default value is 1.- Parameters:
requiredStopCalls- the number of required stop calls, ignored if not positive
-
setMaxEventCount
public void setMaxEventCount(int maxEventCount) Defines the maximum number of (expected) events.- Parameters:
maxEventCount- the maximum number of events
-
incEventCount
public int incEventCount()Increases the event counter.- Returns:
- the new counter value
-
maxEventCountReached
public boolean maxEventCountReached()Returns whether the maximum number of (expected) events was already reached.- Returns:
truefor reached,falseelse
-
getId
Returns the task id.- Returns:
- the id
-
getStatus
Returns the task status.- Returns:
- the status
-
toString
-
sameTask
Returns whether the given taskdatais the same regarding the task id modulo beginning/trailing quotes asgetId().- Parameters:
data- the task id to compare (may be null)- Returns:
trueif both task ids are the same (modulo begining/trailing quotes),
-
sameTask
Returns whether the giventaskIdmodulo beginning/trailing quotes is the same asgetId().- Parameters:
taskId- the task id to compare (may be null)- Returns:
trueif both task ids are the same (modulo begining/trailing quotes),
-