|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.grandcentral.appstats.impl.TaskImpl | +--com.grandcentral.appstats.impl.SynchronizedTaskImpl
Description: A synchronized Task implementation
Copyright: Copyright (c) 2002
Company: Grand Central Communications
Fields inherited from class com.grandcentral.appstats.impl.TaskImpl |
INITIAL_MAP_SIZE, m_agg, m_children, m_errors, m_flushListeners, m_maxErrors, m_name, m_parent, m_statCalculators, m_statMap, m_updateTaskListeners |
Fields inherited from interface com.grandcentral.appstats.Task |
DEFAULT_MAXERRORS, STAT_ERRORCOUNT, TASK_STATE_DEFAULT_NAME, TASK_TIMER_DEFAULT_NAME |
Constructor Summary | |
SynchronizedTaskImpl()
|
Method Summary | |
void |
addChild(Task newChild)
Adds a child subtask to this process. |
void |
addError(java.lang.Throwable ex)
Adds an error to the list. |
void |
aggregate(Task task)
Prcesses data from the finished task, updating any internal counters. |
void |
clear()
clears all stats, errors, and calls clear() on all StatCalculators |
void |
clearErrors()
deletes all errors from this Task |
Stat |
exists(java.lang.String statName)
Returns Stat if stat by that name exists. |
void |
flush()
Marks that this task's job is finished and allows parent Process to record this task's results. |
java.util.List |
getChildren()
Returns all child tasks, or null if none are present. |
Counter |
getCounter(java.lang.String name)
Returns named counter, if such counter does not exist, new one will be created |
java.util.List |
getErrors()
Returns a list of Throwable errors registered with this Task. |
int |
getMaxErrorDepth()
|
java.lang.String |
getName()
Displayable name |
Task |
getParent()
Returns parent object or null iof there is no parent |
java.lang.String |
getProperty(java.lang.String name)
|
Stat |
getStat(java.lang.String name)
Returns existing stat by statName, or creates a new one. |
Stat |
getStat(java.lang.String name,
int type)
convenience method to provide a stat with the specified type. |
StatAggregator |
getStatAggregator()
|
Stat |
getStatByFullName(java.lang.String fullname)
locates a Stat in this Task or a child task based on its fullname |
java.util.List |
getStatNames()
Note: This MUST be a NEW list, to avoid ConcurrentModificationException. |
java.util.List |
getStatNames(int depth)
This function returns stat names visible to this task. |
java.util.List |
getStats()
Note: This MUST be a NEW list, to avoid ConcurrentModificationException in multithreaded envitoment |
java.util.List |
getStats(java.util.Collection names,
int depth)
Stats returned are those matching full names specified in the Collection. |
java.util.List |
getStats(int depth)
This function returns stats visible to this task. Note: If any stats belong to the children of this they are cloned. |
Timer |
getTimer(java.lang.String name)
Returns a Timer for a given type of operation. |
void |
putCounter(Counter counter)
Overwrites old counter with a new one. |
void |
putStat(Stat stat)
stores a Stat in this stat. |
void |
putTimer(Timer timer)
|
void |
registerFlushListener(FlushListener l)
|
void |
registerStatCalculator(StatCalculator c,
java.lang.String statName)
StatCalculator is called upon Task flush/aggregation whenever a stat is encountered with the following statName. |
void |
registerUpdateTaskListener(UpdateTaskListener listener)
Registers an updateTaskListener with this object |
void |
removeChild(Task oldChild)
Removes a child task from the list of active children. |
void |
removeCounter(java.lang.String name)
|
void |
removeFlushListener(FlushListener l)
|
protected void |
removeParent()
|
void |
removeStat(Stat stat)
|
void |
removeStat(java.lang.String statName)
|
void |
removeStatCalculator(java.lang.String statName)
|
boolean |
removeStats(java.util.Collection c)
Removes all Stats that are not present in the collection. |
void |
removeStatsThatStartWith(java.lang.String s)
removes all stats whose statNames start with s. |
void |
removeTimer(java.lang.String name)
|
void |
removeUpdateTaskListener(UpdateTaskListener listener)
removes the task listener registered with a specific child |
void |
setMaxErrorDepth(int maxErrors)
Alter the maximum number of most recent errors to keep in this Task. |
void |
setName(java.lang.String name)
Sets name of this task. |
protected void |
setParent(Task parent)
|
void |
setProperty(java.lang.String name,
java.lang.String property)
Note: if property is null, stat will get Removed even if it contains any additional data |
void |
setStatAggregator(StatAggregator sa)
|
void |
update()
Must be called by the viewer code, before accessing stats. Causes all UpdateTaskListeners to update any fields in the task. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SynchronizedTaskImpl()
Method Detail |
public void setName(java.lang.String name)
TaskImpl
Stat.DELIM_TASKPARENT
character and must not be null.setName
in class TaskImpl
com.grandcentral.appstats.impl.TaskImpl
name
- java.lang.IllegalArgumentException
- if given name is not allowedpublic java.lang.String getName()
Task
getName
in class TaskImpl
com.grandcentral.appstats.Task
public StatAggregator getStatAggregator()
getStatAggregator
in class TaskImpl
public void setStatAggregator(StatAggregator sa)
setStatAggregator
in class TaskImpl
public Timer getTimer(java.lang.String name) throws java.lang.ClassCastException
Task
getTimer
in class TaskImpl
name
- java.lang.ClassCastException
- public void putTimer(Timer timer)
putTimer
in class TaskImpl
public void removeTimer(java.lang.String name)
removeTimer
in class TaskImpl
public void putCounter(Counter counter)
Task
putCounter
in class TaskImpl
com.grandcentral.appstats.Task
counter
- public Counter getCounter(java.lang.String name)
Task
getCounter
in class TaskImpl
com.grandcentral.appstats.Task
name
- of the desired counterpublic void removeCounter(java.lang.String name)
removeCounter
in class TaskImpl
public void setProperty(java.lang.String name, java.lang.String property)
TaskImpl
setProperty
in class TaskImpl
com.grandcentral.appstats.impl.TaskImpl
property
- set to null to REMOVE propertypublic java.lang.String getProperty(java.lang.String name)
getProperty
in class TaskImpl
public void putStat(Stat stat)
Task
putStat
in class TaskImpl
public void removeStat(java.lang.String statName)
removeStat
in class TaskImpl
public void removeStat(Stat stat)
removeStat
in class TaskImpl
public void removeStatsThatStartWith(java.lang.String s)
Task
removeStatsThatStartWith
in class TaskImpl
public Stat getStat(java.lang.String name)
Task
getStat
in class TaskImpl
com.grandcentral.appstats.Task
name
- public Stat getStat(java.lang.String name, int type)
getStat
in class TaskImpl
public Stat getStatByFullName(java.lang.String fullname)
Task
getStatByFullName
in class TaskImpl
com.grandcentral.appstats.Task
Task.update()
,
Stat.getFullName()
public java.util.List getStats()
TaskImpl
getStats
in class TaskImpl
com.grandcentral.appstats.impl.TaskImpl
public java.util.List getStats(int depth)
TaskImpl
getStats
in class TaskImpl
com.grandcentral.appstats.impl.TaskImpl
depth
- number of levels to get stats of. [-1, 0, 1, 2, 3...)
(-1)-full depth, (0)-just this task, (1)-immediate children, etc.
Warning: Maximum depth is limited to abs(Integer.MIN_VALUE)public java.util.List getStatNames()
TaskImpl
getStatNames
in class TaskImpl
com.grandcentral.appstats.impl.TaskImpl
public java.util.List getStatNames(int depth)
TaskImpl
getStatNames
in class TaskImpl
com.grandcentral.appstats.impl.TaskImpl
depth
- number of levels to get stats of. [-1, 0, 1, 2, 3...)
(-1)-full depth, (0)-just this task, (1)-immediate children, etc.
Warning: Maximum depth is limited to abs(Integer.MIN_VALUE)public Stat exists(java.lang.String statName)
Task
exists
in class TaskImpl
com.grandcentral.appstats.Task
statName
- public void addError(java.lang.Throwable ex)
Task
addError
in class TaskImpl
com.grandcentral.appstats.Task
ex
- setMaxErrorDepth()
public java.util.List getErrors()
Task
getErrors
in class TaskImpl
com.grandcentral.appstats.Task
public void clearErrors()
Task
clearErrors
in class TaskImpl
public void setMaxErrorDepth(int maxErrors)
Task
setMaxErrorDepth
in class TaskImpl
public int getMaxErrorDepth()
getMaxErrorDepth
in class TaskImpl
public void flush() throws DatatypeMismatchException
flush
in class TaskImpl
com.grandcentral.appstats.impl.TaskImpl
TaskImpl.update()
,
TaskImpl.aggregate(com.grandcentral.appstats.Task)
public Task getParent()
Task
getParent
in class TaskImpl
com.grandcentral.appstats.Task
protected void setParent(Task parent)
setParent
in class TaskImpl
protected void removeParent()
removeParent
in class TaskImpl
public void addChild(Task newChild)
Task
addChild
in class TaskImpl
public void removeChild(Task oldChild)
Task
removeChild
in class TaskImpl
public java.util.List getChildren()
Task
getChildren
in class TaskImpl
com.grandcentral.appstats.Task
public void registerUpdateTaskListener(UpdateTaskListener listener)
Task
References to UpdateTaskListeners are not serialized along with the Task since they may or may not be serializable themselves.
registerUpdateTaskListener
in class TaskImpl
com.grandcentral.appstats.Task
newChild
- handler
- public void removeUpdateTaskListener(UpdateTaskListener listener)
removeUpdateTaskListener
in class TaskImpl
public void update() throws DatatypeMismatchException
Task
update
in class TaskImpl
com.grandcentral.appstats.Task
DatatypeMismatchException
- UpdateTaskListener
public void registerFlushListener(FlushListener l)
registerFlushListener
in class TaskImpl
public void removeFlushListener(FlushListener l)
removeFlushListener
in class TaskImpl
public void aggregate(Task task)
Task
aggregate
in class TaskImpl
public void registerStatCalculator(StatCalculator c, java.lang.String statName)
Task
registerStatCalculator
in class TaskImpl
com.grandcentral.appstats.Task
java.lang.IllegalArgumentException
- if c instanceof FlushListener or UpdateTaskListenerpublic void removeStatCalculator(java.lang.String statName)
removeStatCalculator
in class TaskImpl
public void clear()
TaskImpl
clear
in class TaskImpl
public boolean removeStats(java.util.Collection c)
Task
removeStats
in class TaskImpl
com.grandcentral.appstats.Task
c
- a Collection of Stat objects that are to be retained,
or a Collection of Strings that are full names of stats to be retained.public java.util.List getStats(java.util.Collection names, int depth)
Task
getStats
in class TaskImpl
com.grandcentral.appstats.Task
names
- a Collection of Strings that are full names of wanted stats.depth
- number of levels to get stats of. [-1, 0, 1, 2, 3...)Task.getStats(int)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |