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.TimerTaskThe 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 booleancancel()Cancel the task.voidfireMessagesAdded(Message[] messages)This method is call by the plugin to pass the messages to be added.longgetAverageExecutionDuration(int number)protected java.util.ListgetDurations()longgetLastExecutionDuration()intgetMessageSize()protected longgetPeriod()booleanisCanceld()booleanisDone()voidrun()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:
cancelin classjava.util.TimerTask
-
run
public void run()
Invokes the messagesAdded notification on the awt thread and meseasures the duration.- Specified by:
runin interfacejava.lang.Runnable- Specified by:
runin classjava.util.TimerTask
-
isDone
public boolean isDone()
- Returns:
trueif the task is done.
-
isCanceld
public boolean isCanceld()
- Returns:
trueif 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
numberexecutions.
-
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.
-
-