Interface ManagedTimer
- All Superinterfaces:
jakarta.ejb.Timer
- All Known Implementing Classes:
CalendarTimer,DistributableTimer,OOBTimer,TimerImpl
public interface ManagedTimer
extends jakarta.ejb.Timer
Interface for managed
Timer implementations.- Author:
- Paul Ferraro
-
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()Activates a previously suspended timer.getId()The unique identifier of this timer.voidinvoke()Invokes the timeout method associated with this timer.booleanisActive()Indicates whether this timer is active, i.e.booleanIndicates whether this timer was canceled, i.e.booleanIndicates whether this timer has expired, i.e.voidsuspend()Suspends a previously active timer.default voidValidates the invocation context of a given specification method.Methods inherited from interface jakarta.ejb.Timer
cancel, getHandle, getInfo, getNextTimeout, getSchedule, getTimeRemaining, isCalendarTimer, isPersistent
-
Method Details
-
getId
String getId()The unique identifier of this timer.- Returns:
- a unique identifier
-
isActive
boolean isActive()Indicates whether this timer is active, i.e. not suspended.- Returns:
- true, if this timer is active, false otherwise.
-
isCanceled
boolean isCanceled()Indicates whether this timer was canceled, i.e. viaTimer.cancel().- Returns:
- true, if this timer was canceled, false otherwise.
-
isExpired
boolean isExpired()Indicates whether this timer has expired, i.e. it has no more timeouts. An interval timer will always return false.- Returns:
- true, if this timer has expired, false otherwise.
-
activate
void activate()Activates a previously suspended timer. Once active, the timer will receive timeout events as usual, including any timeouts missed while inactive. -
suspend
void suspend()Suspends a previously active timer. While suspended, the timer will not receive timeout events. -
invoke
Invokes the timeout method associated with this timer. Has no impact on this timer's schedule.- Throws:
Exception
-
validateInvocationContext
default void validateInvocationContext()Validates the invocation context of a given specification method.
-