001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common Development
008: * and Distribution License("CDDL") (collectively, the "License"). You
009: * may not use this file except in compliance with the License. You can obtain
010: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
011: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
012: * language governing permissions and limitations under the License.
013: *
014: * When distributing the software, include this License Header Notice in each
015: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
016: * Sun designates this particular file as subject to the "Classpath" exception
017: * as provided by Sun in the GPL Version 2 section of the License file that
018: * accompanied this code. If applicable, add the following below the License
019: * Header, with the fields enclosed by brackets [] replaced by your own
020: * identifying information: "Portions Copyrighted [year]
021: * [name of copyright owner]"
022: *
023: * Contributor(s):
024: *
025: * If you wish your version of this file to be governed by only the CDDL or
026: * only the GPL Version 2, indicate your decision by adding "[Contributor]
027: * elects to include this software in this distribution under the [CDDL or GPL
028: * Version 2] license." If you don't indicate a single choice of license, a
029: * recipient has the option to distribute your version of this file under
030: * either the CDDL, the GPL Version 2 or to extend the choice of license to
031: * its licensees as provided above. However, if you add GPL Version 2 code
032: * and therefore, elected the GPL Version 2 license, then the option applies
033: * only if the new code is made subject to such option by the copyright
034: * holder.
035: */
036: package javax.ejb;
037:
038: import java.io.Serializable;
039: import java.util.Date;
040:
041: /**
042: *
043: * The Timer interface contains information about a timer
044: * that was created through the EJB Timer Service.
045: *
046: */
047: public interface Timer {
048:
049: /**
050: * Cause the timer and all its associated expiration notifications to
051: * be cancelled.
052: *
053: *
054: * @exception java.lang.IllegalStateException If this method is
055: * invoked while the instance is in a state that does not allow access
056: * to this method.
057: *
058: * @exception javax.ejb.NoSuchObjectLocalException If invoked on a timer
059: * that has expired or has been cancelled.
060: *
061: * @exception javax.ejb.EJBException If this method could not complete due
062: * to a system-level failure.
063: */
064: public void cancel() throws java.lang.IllegalStateException,
065: javax.ejb.NoSuchObjectLocalException,
066: javax.ejb.EJBException;
067:
068: /**
069: * Get the number of milliseconds that will elapse before the next
070: * scheduled timer expiration.
071: *
072: * @return the number of milliseconds that will elapse before the next
073: * scheduled timer expiration.
074: *
075: * @exception java.lang.IllegalStateException If this method is
076: * invoked while the instance is in a state that does not allow access
077: * to this method.
078: *
079: * @exception javax.ejb.NoSuchObjectLocalException If invoked on a timer
080: * that has expired or has been cancelled.
081: *
082: * @exception javax.ejb.EJBException If this method could not complete due
083: * to a system-level failure.
084: */
085: public long getTimeRemaining()
086: throws java.lang.IllegalStateException,
087: javax.ejb.NoSuchObjectLocalException,
088: javax.ejb.EJBException;
089:
090: /**
091: * Get the point in time at which the next timer expiration is scheduled
092: * to occur.
093: *
094: * @return the point in time at which the next timer expiration is
095: * scheduled to occur.
096: *
097: * @exception java.lang.IllegalStateException If this method is
098: * invoked while the instance is in a state that does not allow access
099: * to this method.
100: *
101: * @exception javax.ejb.NoSuchObjectLocalException If invoked on a timer
102: * that has expired or has been cancelled.
103: *
104: * @exception javax.ejb.EJBException If this method could not complete due
105: * to a system-level failure.
106: */
107: public Date getNextTimeout()
108: throws java.lang.IllegalStateException,
109: javax.ejb.NoSuchObjectLocalException,
110: javax.ejb.EJBException;
111:
112: /**
113: * Get the information associated with the timer at the time of creation.
114: *
115: * @return The Serializable object that was passed in at timer creation, or
116: * null if the info argument passed in at timer creation was null.
117: *
118: * @exception java.lang.IllegalStateException If this method is
119: * invoked while the instance is in a state that does not allow access
120: * to this method.
121: *
122: * @exception javax.ejb.NoSuchObjectLocalException If invoked on a timer
123: * that has expired or has been cancelled.
124: *
125: * @exception javax.ejb.EJBException If this method could not complete due
126: * to a system-level failure.
127: */
128: public Serializable getInfo()
129: throws java.lang.IllegalStateException,
130: javax.ejb.NoSuchObjectLocalException,
131: javax.ejb.EJBException;
132:
133: /**
134: * Get a serializable handle to the timer. This handle can
135: * be used at a later time to re-obtain the timer reference.
136: *
137: * @return a serializable handle to the timer.
138: *
139: * @exception java.lang.IllegalStateException If this method is
140: * invoked while the instance is in a state that does not allow access
141: * to this method.
142: *
143: * @exception javax.ejb.NoSuchObjectLocalException If invoked on a timer
144: * that has expired or has been cancelled.
145: *
146: * @exception javax.ejb.EJBException If this method could not complete due
147: * to a system-level failure.
148: */
149: public TimerHandle getHandle()
150: throws java.lang.IllegalStateException,
151: javax.ejb.NoSuchObjectLocalException,
152: javax.ejb.EJBException;
153:
154: }
|