Package jadex.tools.comanalyzer
Class RefreshTask
- java.lang.Object
-
- java.util.TimerTask
-
- jadex.tools.comanalyzer.RefreshTask
-
- All Implemented Interfaces:
java.lang.Runnable
public class RefreshTask extends java.util.TimerTask
The refresh task. This class invokes the messageAdded notification on a different awt thread and waits for its return to measure the duration for the update. With the duration list one can adjust the time for the refresh rate.
-
-
Constructor Summary
Constructors Constructor Description RefreshTask(ComanalyzerPlugin plugin, long period)
Create a new RefreshTask.RefreshTask(ComanalyzerPlugin plugin, long period, java.util.List durations)
Since TimerTasks cant be rescheduled, this constructor provides the possibility to pass the durationlist from an other task to this one.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
cancel()
Cancel the task.void
fireMessagesAdded(Message[] messages)
This method is call by the plugin to pass the messages to be added.long
getAverageExecutionDuration(int number)
protected java.util.List
getDurations()
long
getLastExecutionDuration()
int
getMessageSize()
protected long
getPeriod()
boolean
isCanceld()
boolean
isDone()
void
run()
Invokes the messagesAdded notification on the awt thread and meseasures the duration.
-
-
-
Constructor Detail
-
RefreshTask
public RefreshTask(ComanalyzerPlugin plugin, long period)
Create a new RefreshTask.- Parameters:
period
- The period this task is scheduled in the timer.plugin
- The ComanalyzerPlugin.
-
RefreshTask
public RefreshTask(ComanalyzerPlugin plugin, long period, java.util.List durations)
Since TimerTasks cant be rescheduled, this constructor provides the possibility to pass the durationlist from an other task to this one.- Parameters:
plugin
- The ComanalyzerPlugin.period
- The period this task is scheduled in the timer.durations
- The passed durationlist.
-
-
Method Detail
-
fireMessagesAdded
public void fireMessagesAdded(Message[] messages)
This method is call by the plugin to pass the messages to be added.- Parameters:
messages
- The messages to be added.
-
getMessageSize
public int getMessageSize()
- Returns:
- The message size.
-
cancel
public boolean cancel()
Cancel the task. If there are messages in the messagelist left, cancel it after the next run.- Overrides:
cancel
in classjava.util.TimerTask
-
run
public void run()
Invokes the messagesAdded notification on the awt thread and meseasures the duration.- Specified by:
run
in interfacejava.lang.Runnable
- Specified by:
run
in classjava.util.TimerTask
-
isDone
public boolean isDone()
- Returns:
true
if the task is done.
-
isCanceld
public boolean isCanceld()
- Returns:
true
if the task is cancelled
-
getAverageExecutionDuration
public long getAverageExecutionDuration(int number)
- Parameters:
number
- The count of the last durations the average is calculated from.- Returns:
- The average duration for the last
number
executions.
-
getLastExecutionDuration
public long getLastExecutionDuration()
- Returns:
- The duration of the last execution.
-
getPeriod
protected long getPeriod()
- Returns:
- The stored period for this task.
-
getDurations
protected java.util.List getDurations()
- Returns:
- The list of durations.
-
-