TimerControl Interface

com.bea.control
TimerControl Interface

public interface TimerControl

    extends Asynchronous, Control

Notifies your application when a specified period of time has elapsed or when a specified absolute time has been reached. When using the TimerControl, you typically begin by setting its onTimeout attribute to the amount of time that should pass from the time the timer starts to the time its onTimeout callback fires. You then write code in an onTimeout callback handler; this code will execute when the timer expires. You can also specify that the timer should continue to fire its onTimeout callback at a specific interval.

For more information about using the EJB control, see Timer Control.


All Superinterfaces
Control, Control, Serializable
All Known Subinterfaces

TimerControl

Nested Class Summary

public static interfaceTimerControl.Callback
           Provides a way for the Timer control to receive callbacks.

Method Summary

public boolean
getCoalesceEvents()
Returns the current value of the coalesce-events attribute.
public String
getRepeatsEvery()
Returns the current interval specified by the repeats-every attribute of the @jc:timer tag or the most recent call to the setRepeatsEvery method.
public long
getTimeout()
Returns the current duration specified by the timeout attribute of the @jc:timer tag of the most recent call to the setTimeout method.
public Date
getTimeoutAt()
Returns the time at which the timer is next scheduled to fire, if the control's repeats-every attribute is set to a value greater than zero.
public void
restart()
Resets the timer.
public void
setCoalesceEvents(boolean coalesce)
Enables or disables the coalesce-events behavior.
public void
setRepeatsEvery(long seconds)
Sets the repeat interval for the timer using seconds since the epoch.
public void
setRepeatsEvery(String interval)
Sets the repeat interval using an xsd:duration string.
public void
setTimeout(long seconds)
Sets the time between start or restart and the first expiration of the timer, in seconds.
public void
setTimeout(String delay)
Sets the time between start or restart and the first expiration of the timer, as an xsd:duration string.
public void
setTimeoutAt(Date time)
Sets the absolute date and time at which the timer will expire the first time after being started or restarted.
public void
start()
Starts the timer.
public void
stop()
Stops the timer.

Method Detail

getCoalesceEvents() Method

public boolean getCoalesceEvents()
Returns the current value of the coalesce-events attribute.

Returns

The current value of the coalesce-events attribute.

getRepeatsEvery() Method

public String getRepeatsEvery()
Returns the current interval specified by the repeats-every attribute of the @jc:timer tag or the most recent call to the setRepeatsEvery method.

Returns

The current repetition interval.

getTimeout() Method

public long getTimeout()
Returns the current duration specified by the timeout attribute of the @jc:timer tag of the most recent call to the setTimeout method.

Returns

The current timeout value.

getTimeoutAt() Method

public Date getTimeoutAt()
Returns the time at which the timer is next scheduled to fire, if the control's repeats-every attribute is set to a value greater than zero. If the repeats-every attribute is set to zero, then the getTimeoutAt method returns the value set by the setTimeoutAt method or the value set in the timeout attribute.

Returns

The time at which the timer is next scheduled to fire its onTimeout callback.

restart() Method

public void restart()
Resets the timer. Any pending events are canceled. The timer will subsequently expire after the repeats-every period has elapsed after this call.


setCoalesceEvents(boolean) Method

public void setCoalesceEvents(boolean coalesce)
Enables or disables the coalesce-events behavior.

Parameters

coalesce
true to coalesce events; otherwise, false.

setRepeatsEvery(long) Method

public void setRepeatsEvery(long seconds)
throws IllegalArgumentException
Sets the repeat interval for the timer using seconds since the epoch.

Parameters

seconds
The repetition interval after which the onTimeout callback should fire after its first expiration.

Exceptions

IllegalArgumentException

setRepeatsEvery(String) Method

public void setRepeatsEvery(String interval)
throws IllegalArgumentException
Sets the repeat interval using an xsd:duration string.

Parameters

interval
The repetition interval after which the onTimeout callback should fire after its first expiration.

Exceptions

IllegalArgumentException

setTimeout(long) Method

public void setTimeout(long seconds)
throws IllegalArgumentException
Sets the time between start or restart and the first expiration of the timer, in seconds.

Parameters

seconds
The duration after which the timer should expire.

Exceptions

IllegalArgumentException

setTimeout(String) Method

public void setTimeout(String delay)
throws IllegalArgumentException
Sets the time between start or restart and the first expiration of the timer, as an xsd:duration string.

Parameters

delay
The duration after which the timer should expire.

Exceptions

IllegalArgumentException

setTimeoutAt(Date) Method

public void setTimeoutAt(Date time)
Sets the absolute date and time at which the timer will expire the first time after being started or restarted.

Parameters

time
The date and time at which the timer should first expire after being started or restarted.

start() Method

public void start()
throws IllegalStateException
Starts the timer. The first timer expiration will occur after the period specified by the timeout attribute has elapsed.

Exceptions

IllegalStateException

stop() Method

public void stop()
Stops the timer. No further timer expiration callbacks will be invoked.