Package org.hippoecm.hst.diagnosis
Class DefaultTaskImpl
- java.lang.Object
-
- org.hippoecm.hst.diagnosis.DefaultTaskImpl
-
- All Implemented Interfaces:
AutoCloseable
,Task
public class DefaultTaskImpl extends Object implements Task
DefaultTaskImpl
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DefaultTaskImpl(Task parentTask, String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Task
createSubtask(Task parentTask, String name)
Creates a realTask
instance.Object
getAttribute(String key)
Retrieve the attribute value by the attribute name.Map<String,Object>
getAttributeMap()
Returns attribute map which is unmodifiable.Enumeration<String>
getAttributeNames()
Enumerates the attribute namesCollection<Task>
getChildTasks()
Returns the child tasks collectionlong
getDurationTimeMillis()
Returns the task execution duration time in millisecondsString
getName()
returns the task nameTask
getParentTask()
boolean
isRunning()
Returns true if the task was started but not stopped.Object
removeAttribute(String key)
Removes the attribute by the attribute name.void
setAttribute(String key, Object value)
Set an attribute for the task.Task
startSubtask(String name)
Starts and returns a child subtask with the name.void
stop()
Stops the task
-
-
-
Method Detail
-
getAttributeMap
public Map<String,Object> getAttributeMap()
Description copied from interface:Task
Returns attribute map which is unmodifiable. So, do not try to put or remove items directly from the returned map.- Specified by:
getAttributeMap
in interfaceTask
- Returns:
-
getAttributeNames
public Enumeration<String> getAttributeNames()
Description copied from interface:Task
Enumerates the attribute names- Specified by:
getAttributeNames
in interfaceTask
-
setAttribute
public void setAttribute(String key, Object value)
Description copied from interface:Task
Set an attribute for the task. The objectvalue
should have a proper #toString method as by default, the #toString method is used for displaying the object in the diagnostics.- Specified by:
setAttribute
in interfaceTask
- Parameters:
key
- attribute namevalue
- attribute value
-
getAttribute
public Object getAttribute(String key)
Description copied from interface:Task
Retrieve the attribute value by the attribute name. When not found,null
is returned- Specified by:
getAttribute
in interfaceTask
-
removeAttribute
public Object removeAttribute(String key)
Description copied from interface:Task
Removes the attribute by the attribute name. When an Object was removed forkey
, this object is returned. Otherwisenull
is returned.- Specified by:
removeAttribute
in interfaceTask
-
getParentTask
public Task getParentTask()
- Specified by:
getParentTask
in interfaceTask
- Returns:
- Returns the parent task and
null
if this is the root task
-
startSubtask
public Task startSubtask(String name)
Description copied from interface:Task
Starts and returns a child subtask with the name.- Specified by:
startSubtask
in interfaceTask
- Returns:
-
stop
public void stop()
Description copied from interface:Task
Stops the task
-
getChildTasks
public Collection<Task> getChildTasks()
Description copied from interface:Task
Returns the child tasks collection- Specified by:
getChildTasks
in interfaceTask
- Returns:
-
isRunning
public boolean isRunning()
Description copied from interface:Task
Returns true if the task was started but not stopped.
-
getDurationTimeMillis
public long getDurationTimeMillis()
Description copied from interface:Task
Returns the task execution duration time in milliseconds- Specified by:
getDurationTimeMillis
in interfaceTask
- Returns:
-
-