public class RunStateFlag extends TransferableObject implements Renderable, TaskIdHolder
RunState of a running AsyncTask.
Note that the current RunState is not necessarily consistent to the
persistent states returned by wasCancelled(), isSucceeded(), isFailed().
A task is typically cancelled from outside which puts it into the wasCancelled() state.
But in fact it will actually continue running until it detects the state change by itself
in which case it throws a CancellationException.| Constructor and Description |
|---|
RunStateFlag(RunStateFlag flag)
Copy constructor for FAST copy of a
RunStateFlag |
RunStateFlag(java.lang.String taskName,
TaskType taskType) |
| Modifier and Type | Method and Description |
|---|---|
void |
addChild(TaskId taskId)
Adds a child taskId during execution
|
void |
checkCancelled()
Throws a
CancellationException if this flag was ever cancelled |
<T> T |
deepClone()
Overridden to create a FAST deep clone of this
RunStateFlag by copy constructor. |
boolean |
equals(java.lang.Object obj)
Compares by
TaskId. |
java.util.List<TaskId> |
getCancellableTaskIds()
Returns the list of
TaskIds of child-tasks in reverse order
as they should be cancelled. |
int |
getChildCount()
Returns the number of child- or sub-tasks that yet have been started within
this task.
|
int |
getChildNestingDepth() |
TaskId |
getCurrentChild()
Returns the
TaskId of the currently executing child/sub-task. |
java.lang.Exception |
getError() |
java.lang.String |
getFullName()
Returns the full name of the task which generally is a path starting with
main-task name followed by the child/sub-tasknames whereas a child/sub-taskname is
concatenated with '+' or a '-' sign respectively.
|
java.lang.String |
getMainTaskName() |
TaskType |
getMainTaskType() |
int |
getMaxChildTasks() |
java.awt.Color |
getRenderColor() |
javax.swing.Icon |
getRenderIcon() |
java.lang.String |
getRenderText() |
RunState |
getRunState() |
TaskId |
getTaskId()
Returns the unique identifier for this task.
|
boolean |
hasChildTasks()
Tells whether a child/sub-task is being executed currently.
|
boolean |
hasCurrentChildTask() |
boolean |
hasError()
Tells whether this stateFlag contains an Exception raised during execution.
|
int |
hashCode() |
boolean |
isCancellable() |
boolean |
isCancelled() |
boolean |
isChildFinished() |
boolean |
isChildRunning() |
boolean |
isChildStarted() |
boolean |
isChildSucceeded() |
boolean |
isFailed() |
boolean |
isFinished() |
boolean |
isProgress() |
boolean |
isRunning() |
boolean |
isRunningAsChildTask() |
boolean |
isStarted() |
boolean |
isSucceeded() |
boolean |
isSyncMode() |
void |
removeLastChild() |
protected void |
reset() |
void |
setCancellable(boolean isCancellable) |
void |
setCancelled()
Sets the cancelled state and marks it persistently as cancelled
|
protected void |
setCancelRequested()
Sets the wasCancelled flag in order to indicate that this task
should not run any further.
|
void |
setChildFinished() |
void |
setChildSucceeded() |
void |
setFailed(java.lang.Exception error)
Sets the FAILED state and stores the error
|
void |
setFinished() |
java.lang.String |
setMainTaskName(java.lang.String taskName)
Sets the name of this task.
|
TaskType |
setMainTaskType(TaskType taskType)
Sets the type of this task.
|
void |
setMaxChildTasks(int maxChildTasks)
Tells the number of child-tasks that are expected to run.
|
void |
setProgress() |
void |
setRunning(boolean isRunning) |
void |
setStarted() |
void |
setSucceeded()
Sets the SUCCEEDED state and marks it persistently as succeeded
|
void |
setSyncMode(boolean isSyncMode)
Sets the task into synchronous execution mode.
|
void |
setTaskId(TaskId taskId)
Setting a new
TaskId means restarting this task as a main-task. |
DumpString |
toDumpString(DumpString s)
This method allows subclasses to add values to the existing DumpString of the superclass.
|
ToString |
toString(ToString s)
This method allows subclasses to add values to the existing ToString of the superclass.
|
boolean |
wasCancelled()
Tells whether the persistent wasCancelled flag has yet been set.
|
boolean |
wasFailed()
Tells whether this stateFlag contains an Exception raised during execution.
|
boolean |
wasSucceeded()
Tells whether the persistent wasSucceeded flag yet has been set.
|
cloneconfigureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toStringpublic RunStateFlag(java.lang.String taskName,
TaskType taskType)
public RunStateFlag(RunStateFlag flag)
RunStateFlagpublic void setRunning(boolean isRunning)
public boolean isRunning()
public java.lang.String setMainTaskName(java.lang.String taskName)
getFullName()public TaskType setMainTaskType(TaskType taskType)
public void setMaxChildTasks(int maxChildTasks)
public int getMaxChildTasks()
public void setSyncMode(boolean isSyncMode)
TaskManager and it won't generate any progress events.public boolean isSyncMode()
setSyncMode(boolean)public int getChildCount()
public int getChildNestingDepth()
public java.lang.String getMainTaskName()
public TaskType getMainTaskType()
public TaskId getTaskId()
TaskIdHolderTaskId.getTaskId in interface TaskIdHolderpublic void setTaskId(TaskId taskId)
TaskId means restarting this task as a main-task.
Thus we must reset the RunStateFlag here!
As the new TaskId is created by the same task both taskName and taskType
must match in TaskId and RunStateFlagprotected void reset()
public RunState getRunState()
public void setStarted()
public void setFailed(java.lang.Exception error)
protected void setCancelRequested()
wasCancelled()public void setCancelled()
wasCancelled()public void setSucceeded()
wasSucceeded()public void setFinished()
public void setProgress()
public boolean isRunningAsChildTask()
public void setChildSucceeded()
public void setChildFinished()
public boolean hasCurrentChildTask()
public boolean isChildRunning()
public boolean isSucceeded()
public boolean isChildStarted()
public boolean isChildSucceeded()
public boolean isChildFinished()
public boolean isStarted()
public boolean isProgress()
public boolean isFinished()
public boolean isCancelled()
public boolean isFailed()
public boolean wasCancelled()
setCancelRequested()public void checkCancelled()
CancellationException if this flag was ever cancelledpublic boolean hasError()
public boolean wasFailed()
public boolean wasSucceeded()
public java.lang.Exception getError()
public void setCancellable(boolean isCancellable)
public boolean isCancellable()
public java.awt.Color getRenderColor()
getRenderColor in interface Renderablepublic javax.swing.Icon getRenderIcon()
getRenderIcon in interface Renderablepublic java.lang.String getRenderText()
getRenderText in interface Renderablepublic java.lang.String getFullName()
public boolean equals(java.lang.Object obj)
TaskId.
Note that RunStateFlags are considered to be equal if they contain
the same TaskId, independent of their current RunState!equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic void addChild(TaskId taskId)
public void removeLastChild()
public boolean hasChildTasks()
public TaskId getCurrentChild()
TaskId of the currently executing child/sub-task.public java.util.List<TaskId> getCancellableTaskIds()
TaskIds of child-tasks in reverse order
as they should be cancelled.public <T> T deepClone()
RunStateFlag by copy constructor.deepClone in interface DeepCloneabledeepClone in class TransferableObjectpublic ToString toString(ToString s)
DumpabletoString in interface DumpabletoString in class DumpableObjectpublic DumpString toDumpString(DumpString s)
DumpabletoDumpString in interface DumpabletoDumpString in class DumpableObjectCopyright © 2014 EsprIT-Systems. All Rights Reserved.