| java.lang.Object org.cougaar.lib.filter.UTILBufferingThread
All known Subclasses: org.cougaar.lib.filter.UTILListeningBufferingThread,
UTILBufferingThread | public class UTILBufferingThread (Code) | | Interacts with a BufferingPlugin.
Implements runnable -- must be started inside a java Thread.
Main methods are addTask and dispatchTasks, which runs whenever
threshold conditions are met.
Note that although the method is named add*Task*, it takes an Object,
not a Task, so that if for some reason a client wanted to buffer
up, say, assets, this class could be used without modification.
This class doesn't do much by itself -- it needs to be a listener
to get tasks.
See Also: UTILListeningBufferingThread |
MAXSIZE | protected long MAXSIZE(Code) | | |
MAXTIME | protected long MAXTIME(Code) | | |
MINSIZE | protected long MINSIZE(Code) | | |
wasWaiting | protected boolean wasWaiting(Code) | | |
addTask | protected void addTask(Object newObject)(Code) | | adds a task to the list that need to be handled
If this is the first task we've seen since last
dispatch, remember the time so we can compare it later
against MAX_TIME.
Synchronized here and in run.
Parameters: newObject - is a new object to be added See Also: UTILBufferingThread.run |
alternateDispatch | protected void alternateDispatch()(Code) | | |
anyTasksLeft | protected boolean anyTasksLeft()(Code) | | are there any tasks left to process
|
dispatchConditionMet | protected boolean dispatchConditionMet(List tasks)(Code) | | Defines when to dispatch buffered tasks
Parameters: tasks - the list of tasks to check for size true if there are more than MAXSIZE # of tasks ORthere are more than MINSIZE and the MAXTIME has been exceeded |
dispatchTasks | protected void dispatchTasks(List tasks)(Code) | | now it is time to deal with the tasks that we have
accumulated.
records last time tasks were dispatched
wraps processBufferedTasks call in COUGAAR transaction
calls UTILBufferingPlugin.processTasks
See Also: UTILBufferingPlugin.processTasks |
getEnvData | protected void getEnvData()(Code) | | Uses the plugin's params to set its parameters.
|
getWaitTime | protected long getWaitTime()(Code) | | time since the first un-dispatched task
|
processBufferedTasks | protected void processBufferedTasks(List bufferedTasks)(Code) | | Overriden in UTILTimeoutBufferingThread
Gives no more than MAXSIZE tasks to plugin
Parameters: bufferedTasks - - currently buffered tasks to give to plugin |
removeTask | protected void removeTask(Object removedObject)(Code) | | |
restartMeLater | protected void restartMeLater()(Code) | | |
restartMeLater | protected void restartMeLater(long waitTime)(Code) | | |
staticTime | protected long staticTime()(Code) | | local helper function
|
|
|