Class TimerBean
java.lang.Object
org.glassfish.ejb.persistent.timer.TimerBean
- All Implemented Interfaces:
TimerLocal
TimerBean is a facade for the persistent state of an EJB Timer.
It is part of the EJB container and is implemented using
Java Persistence API. The standard JPA behavior is useful in
implementing the transactional properties of EJB timers.
When an EJB timer is created by an application, it is not
eligible for expiration until the transaction commits.
Likewise, if a timer is cancelled and the transaction rolls
back, the timer must be reactivated.
To accomplish this, TimerBean registers callbacks with the
transaction manager and interacts with the EJBTimerService
accordingly.
- Author:
- Kenneth Saks, Marina Vatkina
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classTo be used to read in TimerBean.Blob and replace with TimerState.Blob on v2.x upgrade -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel(com.sun.ejb.containers.TimerPrimaryKey timerId) Cancel timer.voidcancelTimers(Collection<TimerState> timers) booleancheckStatus(String resourceJndiName, boolean checkDatabase) intcountActiveTimersByContainer(long containerId) intcountActiveTimersOwnedBy(String ownerId) intintcountActiveTimersOwnedByThisServerByContainer(long containerId) intcountCancelledTimersByContainer(long containerId) intcountCancelledTimersOwnedBy(String ownerId) intintcountCancelledTimersOwnedByThisServerByContainer(long containerId) intcountTimersByApplication(long applicationId) intcountTimersByContainer(long containerId) intcountTimersByContainerAndOwner(long containerId, String ownerId) intcountTimersByContainerAndOwnerAndState(long containerId, String ownerId, int state) intcountTimersByContainerAndState(long containerId, int state) intcountTimersByOwner(String ownerId) intcountTimersByOwnerAndState(String ownerId, int state) intcountTimersOwnedBy(String ownerId) String[]countTimersOwnedByServerIds(String[] serverIds) intintcountTimersOwnedByThisServerByContainer(long containerId) createTimer(String timerId, long containerId, long applicationId, String ownerId, Object timedObjectPrimaryKey, Date initialExpiration, long intervalDuration, com.sun.ejb.containers.EJBTimerSchedule schedule, jakarta.ejb.TimerConfig timerConfig) intdeleteTimersByApplication(long applicationId) intdeleteTimersByContainer(long containerId) findActiveTimerIdsByContainer(long containerId) findActiveTimerIdsByContainers(Collection<Long> containerIds) findActiveTimerIdsOwnedBy(String ownerId) findActiveTimerIdsOwnedByThisServerByContainer(long containerId) findActiveTimersByContainer(long containerId) findActiveTimersOwnedBy(String ownerId) findActiveTimersOwnedByThisServerByContainer(long containerId) findCancelledTimerIdsByContainer(long containerId) findCancelledTimerIdsOwnedBy(String ownerId) findCancelledTimerIdsOwnedByThisServerByContainer(long containerId) findCancelledTimersByContainer(long containerId) findCancelledTimersOwnedBy(String ownerId) findCancelledTimersOwnedByThisServerByContainer(long containerId) findTimer(com.sun.ejb.containers.TimerPrimaryKey timerId) findTimerIdsByContainer(long containerId) findTimerIdsByContainerAndOwner(long containerId, String ownerId) findTimerIdsByContainerAndOwnerAndState(long containerId, String ownerId, int state) findTimerIdsByContainerAndState(long containerId, int state) findTimerIdsByContainersAndState(Collection<Long> containerIds, int state) findTimerIdsByOwner(String ownerId) findTimerIdsByOwnerAndState(String ownerId, int state) findTimerIdsOwnedBy(String ownerId) findTimerIdsOwnedByThisServerByContainer(long containerId) findTimersByContainer(long containerId) findTimersByContainerAndOwner(long containerId, String ownerId) findTimersByContainerAndOwnerAndState(long containerId, String ownerId, int state) findTimersByContainerAndState(long containerId, int state) findTimersByOwnerAndState(String ownerId, int state) findTimersOwnedBy(String ownerId) findTimersOwnedByThisServerByContainer(long containerId) intmigrateTimers(String fromOwnerId, String toOwnerId) voidremove(com.sun.ejb.containers.TimerPrimaryKey timerId) void
-
Constructor Details
-
TimerBean
public TimerBean()
-
-
Method Details
-
findTimer
- Specified by:
findTimerin interfaceTimerLocal
-
findTimerIdsByContainer
- Specified by:
findTimerIdsByContainerin interfaceTimerLocal
-
findTimerIdsByContainerAndState
-
findTimerIdsByContainersAndState
-
findTimerIdsByContainerAndOwner
-
findTimerIdsByContainerAndOwnerAndState
-
findTimerIdsByOwner
-
findTimerIdsByOwnerAndState
-
findTimersByContainer
- Specified by:
findTimersByContainerin interfaceTimerLocal
-
findTimersByContainerAndState
-
findTimersByContainerAndOwner
-
findTimersByContainerAndOwnerAndState
-
findTimersByOwnerAndState
-
countTimersByApplication
public int countTimersByApplication(long applicationId) - Specified by:
countTimersByApplicationin interfaceTimerLocal
-
countTimersByContainer
public int countTimersByContainer(long containerId) - Specified by:
countTimersByContainerin interfaceTimerLocal
-
countTimersByContainerAndState
public int countTimersByContainerAndState(long containerId, int state) -
countTimersByContainerAndOwner
-
countTimersByContainerAndOwnerAndState
-
countTimersByOwner
-
countTimersByOwnerAndState
-
createTimer
public TimerState createTimer(String timerId, long containerId, long applicationId, String ownerId, Object timedObjectPrimaryKey, Date initialExpiration, long intervalDuration, com.sun.ejb.containers.EJBTimerSchedule schedule, jakarta.ejb.TimerConfig timerConfig) throws jakarta.ejb.CreateException - Specified by:
createTimerin interfaceTimerLocal- Throws:
jakarta.ejb.CreateException
-
remove
public void remove(com.sun.ejb.containers.TimerPrimaryKey timerId) - Specified by:
removein interfaceTimerLocal
-
remove
- Specified by:
removein interfaceTimerLocal
-
cancel
public void cancel(com.sun.ejb.containers.TimerPrimaryKey timerId) throws jakarta.ejb.FinderException, Exception Description copied from interface:TimerLocalCancel timer.- Specified by:
cancelin interfaceTimerLocal- Throws:
jakarta.ejb.FinderExceptionException
-
cancelTimers
- Specified by:
cancelTimersin interfaceTimerLocal
-
findActiveTimerIdsByContainer
- Specified by:
findActiveTimerIdsByContainerin interfaceTimerLocal
-
findActiveTimerIdsByContainers
- Specified by:
findActiveTimerIdsByContainersin interfaceTimerLocal
-
findCancelledTimerIdsByContainer
- Specified by:
findCancelledTimerIdsByContainerin interfaceTimerLocal
-
findTimerIdsOwnedByThisServerByContainer
- Specified by:
findTimerIdsOwnedByThisServerByContainerin interfaceTimerLocal
-
findActiveTimerIdsOwnedByThisServerByContainer
- Specified by:
findActiveTimerIdsOwnedByThisServerByContainerin interfaceTimerLocal
-
findCancelledTimerIdsOwnedByThisServerByContainer
- Specified by:
findCancelledTimerIdsOwnedByThisServerByContainerin interfaceTimerLocal
-
findTimerIdsOwnedByThisServer
- Specified by:
findTimerIdsOwnedByThisServerin interfaceTimerLocal
-
findActiveTimerIdsOwnedByThisServer
- Specified by:
findActiveTimerIdsOwnedByThisServerin interfaceTimerLocal
-
findCancelledTimerIdsOwnedByThisServer
- Specified by:
findCancelledTimerIdsOwnedByThisServerin interfaceTimerLocal
-
findTimerIdsOwnedBy
- Specified by:
findTimerIdsOwnedByin interfaceTimerLocal
-
findActiveTimerIdsOwnedBy
- Specified by:
findActiveTimerIdsOwnedByin interfaceTimerLocal
-
findCancelledTimerIdsOwnedBy
- Specified by:
findCancelledTimerIdsOwnedByin interfaceTimerLocal
-
findActiveTimersByContainer
- Specified by:
findActiveTimersByContainerin interfaceTimerLocal
-
findCancelledTimersByContainer
- Specified by:
findCancelledTimersByContainerin interfaceTimerLocal
-
findTimersOwnedByThisServerByContainer
- Specified by:
findTimersOwnedByThisServerByContainerin interfaceTimerLocal
-
findActiveTimersOwnedByThisServerByContainer
- Specified by:
findActiveTimersOwnedByThisServerByContainerin interfaceTimerLocal
-
findCancelledTimersOwnedByThisServerByContainer
- Specified by:
findCancelledTimersOwnedByThisServerByContainerin interfaceTimerLocal
-
findTimersOwnedByThisServer
- Specified by:
findTimersOwnedByThisServerin interfaceTimerLocal
-
findActiveTimersOwnedByThisServer
- Specified by:
findActiveTimersOwnedByThisServerin interfaceTimerLocal
-
findCancelledTimersOwnedByThisServer
- Specified by:
findCancelledTimersOwnedByThisServerin interfaceTimerLocal
-
findTimersOwnedBy
- Specified by:
findTimersOwnedByin interfaceTimerLocal
-
findActiveTimersOwnedBy
- Specified by:
findActiveTimersOwnedByin interfaceTimerLocal
-
findCancelledTimersOwnedBy
- Specified by:
findCancelledTimersOwnedByin interfaceTimerLocal
-
countActiveTimersByContainer
public int countActiveTimersByContainer(long containerId) - Specified by:
countActiveTimersByContainerin interfaceTimerLocal
-
countCancelledTimersByContainer
public int countCancelledTimersByContainer(long containerId) - Specified by:
countCancelledTimersByContainerin interfaceTimerLocal
-
countTimersOwnedByThisServerByContainer
public int countTimersOwnedByThisServerByContainer(long containerId) - Specified by:
countTimersOwnedByThisServerByContainerin interfaceTimerLocal
-
countActiveTimersOwnedByThisServerByContainer
public int countActiveTimersOwnedByThisServerByContainer(long containerId) - Specified by:
countActiveTimersOwnedByThisServerByContainerin interfaceTimerLocal
-
countCancelledTimersOwnedByThisServerByContainer
public int countCancelledTimersOwnedByThisServerByContainer(long containerId) - Specified by:
countCancelledTimersOwnedByThisServerByContainerin interfaceTimerLocal
-
countTimersOwnedByThisServer
public int countTimersOwnedByThisServer()- Specified by:
countTimersOwnedByThisServerin interfaceTimerLocal
-
countTimersOwnedByServerIds
- Specified by:
countTimersOwnedByServerIdsin interfaceTimerLocal
-
countActiveTimersOwnedByThisServer
public int countActiveTimersOwnedByThisServer()- Specified by:
countActiveTimersOwnedByThisServerin interfaceTimerLocal
-
countCancelledTimersOwnedByThisServer
public int countCancelledTimersOwnedByThisServer()- Specified by:
countCancelledTimersOwnedByThisServerin interfaceTimerLocal
-
countTimersOwnedBy
- Specified by:
countTimersOwnedByin interfaceTimerLocal
-
countActiveTimersOwnedBy
- Specified by:
countActiveTimersOwnedByin interfaceTimerLocal
-
countCancelledTimersOwnedBy
- Specified by:
countCancelledTimersOwnedByin interfaceTimerLocal
-
checkStatus
- Specified by:
checkStatusin interfaceTimerLocal
-
migrateTimers
- Specified by:
migrateTimersin interfaceTimerLocal
-
deleteTimersByContainer
public int deleteTimersByContainer(long containerId) - Specified by:
deleteTimersByContainerin interfaceTimerLocal
-
deleteTimersByApplication
public int deleteTimersByApplication(long applicationId) - Specified by:
deleteTimersByApplicationin interfaceTimerLocal
-