站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 j2ee API Documentation 英文版文档

Timer (JBoss J2EE API) - JBoss 4.0.1 sp1 j2ee API Documentation 英文版文档


javax.ejb
Interface Timer


public interface Timer

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


Method Summary
 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.
 

Method Detail

cancel

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

Throws:
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

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

Returns:
Number of milliseconds that will elapse before the next scheduled timer expiration.
Throws:
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

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

Returns:
Get the point in time at which the next timer expiration is scheduled to occur.
Throws:
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

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

Returns:
The Serializable object that was passed in at timer creation, or null if the info argument passed in at timer creation was null.
Throws:
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

public 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.

Returns:
Handle of the Timer
Throws:
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.


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.