Timer (Java EE 5 SDK)

Java

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


javax.ejb Interface Timer


public interface Timer

The Timer interface contains information about a timer that was created through the EJB Timer Service.


方法摘要
 void cancel()
          Cause the timer and all its associated expiration notifications to be cancelled.
 TimerHandle getHandle()
          Get a serializable handle to the timer.
 Serializable getInfo()
          Get the information associated with the timer at the time of creation.
 Date getNextTimeout()
          Get the point in time at which the next timer expiration is scheduled to occur.
 long getTimeRemaining()
          Get the number of milliseconds that will elapse before the next scheduled timer expiration.
 

方法详细信息

cancel

void cancel()
            throws IllegalStateException,
                   NoSuchObjectLocalException,
                   EJBException
Cause the timer and all its associated expiration notifications to be cancelled.

抛出异常:
IllegalStateException - If this method is invoked while the instance is in a state that does not allow access to this method.
NoSuchObjectLocalException - If invoked on a timer that has expired or has been cancelled.
EJBException - If this method could not complete due to a system-level failure.

getTimeRemaining

long getTimeRemaining()
                      throws IllegalStateException,
                             NoSuchObjectLocalException,
                             EJBException
Get the number of milliseconds that will elapse before the next scheduled timer expiration.

返回:
the number of milliseconds that will elapse before the next scheduled timer expiration.
抛出异常:
IllegalStateException - If this method is invoked while the instance is in a state that does not allow access to this method.
NoSuchObjectLocalException - If invoked on a timer that has expired or has been cancelled.
EJBException - If this method could not complete due to a system-level failure.

getNextTimeout

Date getNextTimeout()
                    throws IllegalStateException,
                           NoSuchObjectLocalException,
                           EJBException
Get the point in time at which the next timer expiration is scheduled to occur.

返回:
the point in time at which the next timer expiration is scheduled to occur.
抛出异常:
IllegalStateException - If this method is invoked while the instance is in a state that does not allow access to this method.
NoSuchObjectLocalException - If invoked on a timer that has expired or has been cancelled.
EJBException - If this method could not complete due to a system-level failure.

getInfo

Serializable getInfo()
                     throws IllegalStateException,
                            NoSuchObjectLocalException,
                            EJBException
Get the information associated with the timer at the time of creation.

返回:
The Serializable object that was passed in at timer creation, or null if the info argument passed in at timer creation was null.
抛出异常:
IllegalStateException - If this method is invoked while the instance is in a state that does not allow access to this method.
NoSuchObjectLocalException - If invoked on a timer that has expired or has been cancelled.
EJBException - If this method could not complete due to a system-level failure.

getHandle

TimerHandle getHandle()
                      throws IllegalStateException,
                             NoSuchObjectLocalException,
                             EJBException
Get a serializable handle to the timer. This handle can be used at a later time to re-obtain the timer reference.

返回:
a serializable handle to the timer.
抛出异常:
IllegalStateException - If this method is invoked while the instance is in a state that does not allow access to this method.
NoSuchObjectLocalException - If invoked on a timer that has expired or has been cancelled.
EJBException - If this method could not complete due to a system-level failure.

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


提交错误或意见

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.