KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > example > PeriodicTaskMBean


1 package example;
2
3 /**
4  * Perform a task and keep track of statistics.
5  */

6 public interface PeriodicTaskMBean {
7   /**
8    * The estimated amount of milliseconds that the task will take,
9    * used when the PeriodicTask has not been run yet so no historical data
10    * is available. Default is 5000.
11    */

12   public void setEstimatedAverageTime(long estimatedAverageTime);
13
14   /**
15    * The estimated amount of milliseconds that the task will take,
16    * used when the PeriodicTask has not been run yet so no historical data
17    * is available.
18    */

19   public long getEstimatedAverageTime();
20
21   /**
22    * True if the task is currently active.
23    */

24   public boolean isActive();
25
26   /**
27    * If currently active, how much longer will the task take?
28    *
29    * @return the estimate in milliseconds, 0 if not currently active
30    */

31   public long getEstimatedTimeRemaining();
32
33   /**
34    * The last time the task was started.
35    *
36    * @return the last active time, in milliseconds since the epoch
37    */

38   public long getLastActiveTime();
39
40   /**
41    * The number of times the task has been performed.
42    */

43   public long getTotalActiveCount();
44
45   /**
46    * The total amount of time the tasks have taken.
47    *
48    * @return the total active time, in milliseconds
49    */

50   public long getTotalActiveTime();
51
52   /**
53    * The average amount of time the task has taken.
54    * If the task has never been run, then the estimatedAverageTime is returned.
55    *
56    * @return the average active time, in milliseconds
57    */

58   public long getAverageActiveTime();
59
60   /**
61    * Execute the task. Only one execution of the task can take place at a
62    * time, if the task is currently active, this method returns immediately.
63    */

64   public void run();
65 }
66
67
Popular Tags