1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
package f00f.net.irc.martyr;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
/**
* @since 0.3.2
* */
public class CronManager
{
private Timer timer;
public CronManager()
{
timer = new Timer();
}
/**
* @param task TimerTask to schedule
* @param time When to schedule task
*/
public void schedule(TimerTask task, Date time)
{
timer.schedule(task, time);
}
/**
* @param task TimerTask to schedule
* @param firstTime When to run first
* @param period How often to run
*/
public void schedule(TimerTask task, Date firstTime, long period)
{
timer.schedule(task, firstTime, period);
}
/**
* @param task TimerTask to schedule
* @param delay How long to wait before running
*/
public void schedule(TimerTask task, long delay)
{
timer.schedule(task, delay);
}
/**
* @param task TimerTask to schedule
* @param delay How long to wait before running
* @param period How often to run
*/
public void schedule(TimerTask task, long delay, long period)
{
timer.schedule(task, delay, period);
}
/**
* @param task TimerTask to schedule
* @param firstTime When first to run
* @param period How often to run
*/
public void scheduleAtFixedRate(
TimerTask task,
Date firstTime,
long period)
{
timer.scheduleAtFixedRate(task, firstTime, period);
}
/**
* @param task TimerTask to schedule
* @param delay When first to run
* @param period How often to run
*/
public void scheduleAtFixedRate(TimerTask task, long delay, long period)
{
timer.scheduleAtFixedRate(task, delay, period);
}
}
|