KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > ejb > Timer


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: Timer.java 1100 2006-08-16 13:05:31Z benoitf $
23  * --------------------------------------------------------------------------
24  */

25
26 package javax.ejb;
27
28 import java.io.Serializable JavaDoc;
29 import java.util.Date JavaDoc;
30
31 /**
32  * The Timer interface contains information about a timer that was created
33  * through the EJB Timer Service.
34  * @see <a HREF="http://www.jcp.org/en/jsr/detail?id=220">EJB 3.0 specification</a>
35  * @author Florent Benoit
36  */

37 public interface Timer {
38
39     /**
40      * Cause the timer and all its associated expiration notifications to be
41      * cancelled.
42      * @throws IllegalStateException If this method is invoked while the
43      * instance is in a state that does not allow access to this method.
44      * @throws NoSuchObjectLocalException If invoked on a timer that has expired
45      * or has been cancelled.
46      * @throws EJBException If this method could not complete due to a
47      * system-level failure.
48      */

49     void cancel() throws IllegalStateException JavaDoc, NoSuchObjectLocalException JavaDoc, EJBException JavaDoc;
50
51     /**
52      * Get the number of milliseconds that will elapse before the next scheduled
53      * timer expiration.
54      * @return the number of milliseconds that will elapse before the next
55      * scheduled timer expiration.
56      * @throws IllegalStateException If this method is invoked while the
57      * instance is in a state that does not allow access to this method.
58      * @throws NoSuchObjectLocalException If invoked on a timer that has expired
59      * or has been cancelled.
60      * @throws EJBException If this method could not complete due to a
61      * system-level failure.
62      */

63     long getTimeRemaining() throws IllegalStateException JavaDoc, NoSuchObjectLocalException JavaDoc, EJBException JavaDoc;
64
65     /**
66      * Get the point in time at which the next timer expiration is scheduled to
67      * occur.
68      * @return the point in time at which the next timer expiration is scheduled
69      * to occur.
70      * @throws IllegalStateException If this method is invoked while the
71      * instance is in a state that does not allow access to this method.
72      * @throws NoSuchObjectLocalException If invoked on a timer that has expired
73      * or has been cancelled.
74      * @throws EJBException If this method could not complete due to a
75      * system-level failure.
76      */

77     Date JavaDoc getNextTimeout() throws IllegalStateException JavaDoc, NoSuchObjectLocalException JavaDoc, EJBException JavaDoc;
78
79     /**
80      * Get the information associated with the timer at the time of creation.
81      * @return The Serializable object that was passed in at timer creation, or
82      * null if the info argument passed in at timer creation was null.
83      * @throws IllegalStateException If this method is invoked while the
84      * instance is in a state that does not allow access to this method.
85      * @throws NoSuchObjectLocalException If invoked on a timer that has expired
86      * or has been cancelled.
87      * @throws EJBException If this method could not complete due to a
88      * system-level failure.
89      */

90     Serializable JavaDoc getInfo() throws IllegalStateException JavaDoc, NoSuchObjectLocalException JavaDoc, EJBException JavaDoc;
91
92     /**
93      * Get a serializable handle to the timer. This handle can be used at a
94      * later time to re-obtain the timer reference.
95      * @return a serializable handle to the timer.
96      * @throws IllegalStateException If this method is invoked while the
97      * instance is in a state that does not allow access to this method.
98      * @throws NoSuchObjectLocalException If invoked on a timer that has expired
99      * or has been cancelled.
100      * @throws EJBException If this method could not complete due to a
101      * system-level failure.
102      */

103     TimerHandle JavaDoc getHandle() throws IllegalStateException JavaDoc, NoSuchObjectLocalException JavaDoc, EJBException JavaDoc;
104
105 }
106
Popular Tags