Timer (Java EE 5)

Java EE API


javax.ejb Interface Timer


public interface Timer


Timer 接口包含有关通过 EJB Timer Service 创建的计时器的信息。
英文文档:

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


Method Summary
 void
 TimerHandle
 Serializable
 Date
 long
 

Method Detail

public void cancel() throws IllegalStateException, NoSuchObjectLocalException, EJBException
导致删除计时器及其所有相关过期通知。
ThrowsIllegalStateException: 如果在实例不允许访问此方法的情况下调用了此方法。
ThrowsNoSuchObjectLocalException: 如果对已经过期或删除的计时器调用此方法。
ThrowsEJBException: 如果此方法由于系统级失败而无法完成。
英文文档:

cancel

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.

public long getTimeRemaining() throws IllegalStateException, NoSuchObjectLocalException, EJBException
获得下一个已安排的计时器过期之前要经历的毫秒数。
return 下一个已安排的计时器过期之前要经历的毫秒数。
ThrowsIllegalStateException: 如果在实例不允许访问此方法的情况下调用了此方法。
ThrowsNoSuchObjectLocalException: 如果对已经过期或删除的计时器调用此方法。
ThrowsEJBException: 如果此方法由于系统级失败而无法完成。
英文文档:

getTimeRemaining

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

Returns:
the 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.

public java.util.Date getNextTimeout() throws IllegalStateException, NoSuchObjectLocalException, EJBException
获得下一个计时器过期计划发生的时间点。
return 下一个计时器过期计划发生的时间点。
ThrowsIllegalStateException: 如果在实例不允许访问此方法的情况下调用了此方法。
ThrowsNoSuchObjectLocalException: 如果对已经过期或删除的计时器调用此方法。
ThrowsEJBException: 如果此方法由于系统级失败而无法完成。
英文文档:

getNextTimeout

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

Returns:
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.

public java.io.Serializable getInfo() throws IllegalStateException, NoSuchObjectLocalException, EJBException
获得计时器创建时,与计时器相关的信息。
return 在计时器创建时传入的 Serializable 对象;如果在计时器创建时传入的 info 参数为 null,则返回 null。
ThrowsIllegalStateException: 如果在实例不允许访问此方法的情况下调用了此方法。
ThrowsNoSuchObjectLocalException: 如果对已经过期或删除的计时器调用此方法。
ThrowsEJBException: 如果此方法由于系统级失败而无法完成。
英文文档:

getInfo

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.

public TimerHandle getHandle() throws IllegalStateException, NoSuchObjectLocalException, EJBException
获得计时器的可序列化句柄。此句柄可用于以后重新获得计时器引用。
return 计时器的可序列化句柄。
ThrowsIllegalStateException: 如果在实例不允许访问此方法的情况下调用了此方法。
ThrowsNoSuchObjectLocalException: 如果对已经过期或删除的计时器调用此方法。
ThrowsEJBException: 如果此方法由于系统级失败而无法完成。
英文文档:

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.

Returns:
a serializable handle to 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.


Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!