1 /*
2 * JBoss, Home of Professional Open Source.
3 * Copyright 2006, Red Hat Middleware LLC, and individual contributors
4 * as indicated by the @author tags. See the copyright.txt file in the
5 * distribution for a full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */
22 package org.jboss.resource.spi.timer;
23
24 import java.util.Date;
25
26 /**
27 * The TimerManager interface represents core timer management facilities.
28 * Primary responsiblities include scheduling timers, removing timers. Further,
29 * the interface allows for certain lifecycle manipulation of the TimerManager.
30 *
31 *
32 * @author <a href="weston.price@jboss.com">Weston Price</a>
33 * @version $Revision: 71554 $
34 *
35 * @see Timer
36 * @see TimerListener
37 * @see CancelTimerListener
38 * @see StopTimerListener
39 *
40 */
41 public interface TimerManager
42 {
43
44 /**
45 * Request that the TimerManager schedule a timer that will expire at
46 * the specified date.
47 *
48 * @param listener the timer listener.
49 * @param time the time that the timer will expire.
50 *
51 * @see TimerListener
52 * @see Timer
53 *
54 * @return the newly created and scheduled timer.
55 *
56 *
57 */
58 public Timer schedule(TimerListener listener, Date time);
59
60
61 /**
62 * Create and schedule a timer with the listener.
63 *
64 * @param listener
65 * @param time
66 * @param period
67 * @return
68 */
69 public Timer schedule(TimerListener listener, Date time, long period);
70
71 /**
72 * FIXME Comment this
73 *
74 * @param listener
75 * @param delay
76 * @return
77 */
78 public Timer schedule(TimerListener listener, long delay);
79
80 /**
81 * FIXME Comment this
82 *
83 * @param listener
84 * @param delay
85 * @param period
86 * @return
87 */
88 public Timer schedule(TimerListener listener, long delay, long period) ;
89
90 /**
91 * FIXME Comment this
92 *
93 * @param context
94 * @return
95 */
96 public Timer schedule(TimerExcecutionContext context);
97
98 /**
99 * FIXME Comment this
100 *
101 * @param listener
102 * @param time
103 * @param period
104 * @return
105 */
106 public Timer schedule(TimerListener listener, Date time, TimerPeriod period);
107
108 /**
109 * FIXME Comment this
110 *
111 * @param listener
112 * @param time
113 * @param period
114 * @return
115 */
116 public Timer schedule(TimerListener listener, TimerDate time, TimerPeriod period);
117
118 /**
119 * FIXME Comment this
120 *
121 * @param timer
122 */
123 public void cancelTimer(Timer timer);
124
125 /**
126 * FIXME Comment this
127 *
128 * @param timerName
129 */
130 public void cancelTimer(String timerName);
131
132
133 /**
134 * FIXME Comment this
135 *
136 */
137 public void stop();
138
139 /**
140 * FIXME Comment this
141 *
142 */
143 public void suspend();
144
145 /**
146 * FIXME Comment this
147 *
148 */
149 public void resume();
150
151 /**
152 * FIXME Comment this
153 *
154 * @return
155 */
156 public boolean isSuspending();
157
158
159 /**
160 * FIXME Comment this
161 *
162 * @return
163 */
164 public boolean isStopped();
165
166
167 }