Class TimerBean
- java.lang.Object
-
- org.glassfish.ejb.persistent.timer.TimerBean
-
- All Implemented Interfaces:
TimerLocal
public class TimerBean extends Object implements 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 Classes Modifier and Type Class Description static class
TimerBean.Blob
To be used to read in TimerBean.Blob and replace with TimerState.Blob on v2.x upgrade
-
Constructor Summary
Constructors Constructor Description TimerBean()
-
Method Summary
-
-
-
Method Detail
-
findTimer
public TimerState findTimer(TimerPrimaryKey timerId)
- Specified by:
findTimer
in interfaceTimerLocal
-
findTimerIdsByContainer
public Set findTimerIdsByContainer(long containerId)
- Specified by:
findTimerIdsByContainer
in interfaceTimerLocal
-
findTimerIdsByContainerAndState
public Set findTimerIdsByContainerAndState(long containerId, int state)
-
findTimerIdsByContainersAndState
public Set findTimerIdsByContainersAndState(Collection<Long> containerIds, int state)
-
findTimerIdsByContainerAndOwner
public Set findTimerIdsByContainerAndOwner(long containerId, String ownerId)
-
findTimerIdsByContainerAndOwnerAndState
public Set findTimerIdsByContainerAndOwnerAndState(long containerId, String ownerId, int state)
-
findTimersByContainer
public Set findTimersByContainer(long containerId)
- Specified by:
findTimersByContainer
in interfaceTimerLocal
-
findTimersByContainerAndState
public Set findTimersByContainerAndState(long containerId, int state)
-
findTimersByContainerAndOwner
public Set findTimersByContainerAndOwner(long containerId, String ownerId)
-
findTimersByContainerAndOwnerAndState
public Set findTimersByContainerAndOwnerAndState(long containerId, String ownerId, int state)
-
countTimersByApplication
public int countTimersByApplication(long applicationId)
- Specified by:
countTimersByApplication
in interfaceTimerLocal
-
countTimersByContainer
public int countTimersByContainer(long containerId)
- Specified by:
countTimersByContainer
in interfaceTimerLocal
-
countTimersByContainerAndState
public int countTimersByContainerAndState(long containerId, int state)
-
countTimersByContainerAndOwner
public int countTimersByContainerAndOwner(long containerId, String ownerId)
-
countTimersByContainerAndOwnerAndState
public int countTimersByContainerAndOwnerAndState(long containerId, String ownerId, int state)
-
countTimersByOwner
public int countTimersByOwner(String ownerId)
-
countTimersByOwnerAndState
public int countTimersByOwnerAndState(String ownerId, int state)
-
createTimer
public TimerState createTimer(String timerId, long containerId, long applicationId, String ownerId, Object timedObjectPrimaryKey, Date initialExpiration, long intervalDuration, EJBTimerSchedule schedule, jakarta.ejb.TimerConfig timerConfig) throws jakarta.ejb.CreateException
- Specified by:
createTimer
in interfaceTimerLocal
- Throws:
jakarta.ejb.CreateException
-
remove
public void remove(TimerPrimaryKey timerId)
- Specified by:
remove
in interfaceTimerLocal
-
remove
public void remove(Set<TimerPrimaryKey> timerIds)
- Specified by:
remove
in interfaceTimerLocal
-
cancel
public void cancel(TimerPrimaryKey timerId) throws jakarta.ejb.FinderException, Exception
Description copied from interface:TimerLocal
Cancel timer.- Specified by:
cancel
in interfaceTimerLocal
- Throws:
jakarta.ejb.FinderException
Exception
-
cancelTimers
public void cancelTimers(Collection<TimerState> timers)
- Specified by:
cancelTimers
in interfaceTimerLocal
-
findActiveTimerIdsByContainer
public Set findActiveTimerIdsByContainer(long containerId)
- Specified by:
findActiveTimerIdsByContainer
in interfaceTimerLocal
-
findActiveTimerIdsByContainers
public Set findActiveTimerIdsByContainers(Collection<Long> containerIds)
- Specified by:
findActiveTimerIdsByContainers
in interfaceTimerLocal
-
findCancelledTimerIdsByContainer
public Set findCancelledTimerIdsByContainer(long containerId)
- Specified by:
findCancelledTimerIdsByContainer
in interfaceTimerLocal
-
findTimerIdsOwnedByThisServerByContainer
public Set findTimerIdsOwnedByThisServerByContainer(long containerId)
- Specified by:
findTimerIdsOwnedByThisServerByContainer
in interfaceTimerLocal
-
findActiveTimerIdsOwnedByThisServerByContainer
public Set findActiveTimerIdsOwnedByThisServerByContainer(long containerId)
- Specified by:
findActiveTimerIdsOwnedByThisServerByContainer
in interfaceTimerLocal
-
findCancelledTimerIdsOwnedByThisServerByContainer
public Set findCancelledTimerIdsOwnedByThisServerByContainer(long containerId)
- Specified by:
findCancelledTimerIdsOwnedByThisServerByContainer
in interfaceTimerLocal
-
findTimerIdsOwnedByThisServer
public Set findTimerIdsOwnedByThisServer()
- Specified by:
findTimerIdsOwnedByThisServer
in interfaceTimerLocal
-
findActiveTimerIdsOwnedByThisServer
public Set findActiveTimerIdsOwnedByThisServer()
- Specified by:
findActiveTimerIdsOwnedByThisServer
in interfaceTimerLocal
-
findCancelledTimerIdsOwnedByThisServer
public Set findCancelledTimerIdsOwnedByThisServer()
- Specified by:
findCancelledTimerIdsOwnedByThisServer
in interfaceTimerLocal
-
findTimerIdsOwnedBy
public Set findTimerIdsOwnedBy(String ownerId)
- Specified by:
findTimerIdsOwnedBy
in interfaceTimerLocal
-
findActiveTimerIdsOwnedBy
public Set findActiveTimerIdsOwnedBy(String ownerId)
- Specified by:
findActiveTimerIdsOwnedBy
in interfaceTimerLocal
-
findCancelledTimerIdsOwnedBy
public Set findCancelledTimerIdsOwnedBy(String ownerId)
- Specified by:
findCancelledTimerIdsOwnedBy
in interfaceTimerLocal
-
findActiveTimersByContainer
public Set findActiveTimersByContainer(long containerId)
- Specified by:
findActiveTimersByContainer
in interfaceTimerLocal
-
findCancelledTimersByContainer
public Set findCancelledTimersByContainer(long containerId)
- Specified by:
findCancelledTimersByContainer
in interfaceTimerLocal
-
findTimersOwnedByThisServerByContainer
public Set findTimersOwnedByThisServerByContainer(long containerId)
- Specified by:
findTimersOwnedByThisServerByContainer
in interfaceTimerLocal
-
findActiveTimersOwnedByThisServerByContainer
public Set findActiveTimersOwnedByThisServerByContainer(long containerId)
- Specified by:
findActiveTimersOwnedByThisServerByContainer
in interfaceTimerLocal
-
findCancelledTimersOwnedByThisServerByContainer
public Set findCancelledTimersOwnedByThisServerByContainer(long containerId)
- Specified by:
findCancelledTimersOwnedByThisServerByContainer
in interfaceTimerLocal
-
findTimersOwnedByThisServer
public Set findTimersOwnedByThisServer()
- Specified by:
findTimersOwnedByThisServer
in interfaceTimerLocal
-
findActiveTimersOwnedByThisServer
public Set findActiveTimersOwnedByThisServer()
- Specified by:
findActiveTimersOwnedByThisServer
in interfaceTimerLocal
-
findCancelledTimersOwnedByThisServer
public Set findCancelledTimersOwnedByThisServer()
- Specified by:
findCancelledTimersOwnedByThisServer
in interfaceTimerLocal
-
findTimersOwnedBy
public Set findTimersOwnedBy(String ownerId)
- Specified by:
findTimersOwnedBy
in interfaceTimerLocal
-
findActiveTimersOwnedBy
public Set findActiveTimersOwnedBy(String ownerId)
- Specified by:
findActiveTimersOwnedBy
in interfaceTimerLocal
-
findCancelledTimersOwnedBy
public Set findCancelledTimersOwnedBy(String ownerId)
- Specified by:
findCancelledTimersOwnedBy
in interfaceTimerLocal
-
countActiveTimersByContainer
public int countActiveTimersByContainer(long containerId)
- Specified by:
countActiveTimersByContainer
in interfaceTimerLocal
-
countCancelledTimersByContainer
public int countCancelledTimersByContainer(long containerId)
- Specified by:
countCancelledTimersByContainer
in interfaceTimerLocal
-
countTimersOwnedByThisServerByContainer
public int countTimersOwnedByThisServerByContainer(long containerId)
- Specified by:
countTimersOwnedByThisServerByContainer
in interfaceTimerLocal
-
countActiveTimersOwnedByThisServerByContainer
public int countActiveTimersOwnedByThisServerByContainer(long containerId)
- Specified by:
countActiveTimersOwnedByThisServerByContainer
in interfaceTimerLocal
-
countCancelledTimersOwnedByThisServerByContainer
public int countCancelledTimersOwnedByThisServerByContainer(long containerId)
- Specified by:
countCancelledTimersOwnedByThisServerByContainer
in interfaceTimerLocal
-
countTimersOwnedByThisServer
public int countTimersOwnedByThisServer()
- Specified by:
countTimersOwnedByThisServer
in interfaceTimerLocal
-
countTimersOwnedByServerIds
public String[] countTimersOwnedByServerIds(String[] serverIds)
- Specified by:
countTimersOwnedByServerIds
in interfaceTimerLocal
-
countActiveTimersOwnedByThisServer
public int countActiveTimersOwnedByThisServer()
- Specified by:
countActiveTimersOwnedByThisServer
in interfaceTimerLocal
-
countCancelledTimersOwnedByThisServer
public int countCancelledTimersOwnedByThisServer()
- Specified by:
countCancelledTimersOwnedByThisServer
in interfaceTimerLocal
-
countTimersOwnedBy
public int countTimersOwnedBy(String ownerId)
- Specified by:
countTimersOwnedBy
in interfaceTimerLocal
-
countActiveTimersOwnedBy
public int countActiveTimersOwnedBy(String ownerId)
- Specified by:
countActiveTimersOwnedBy
in interfaceTimerLocal
-
countCancelledTimersOwnedBy
public int countCancelledTimersOwnedBy(String ownerId)
- Specified by:
countCancelledTimersOwnedBy
in interfaceTimerLocal
-
checkStatus
public boolean checkStatus(String resourceJndiName, boolean checkDatabase)
- Specified by:
checkStatus
in interfaceTimerLocal
-
migrateTimers
public int migrateTimers(String fromOwnerId, String toOwnerId)
- Specified by:
migrateTimers
in interfaceTimerLocal
-
deleteTimersByContainer
public int deleteTimersByContainer(long containerId)
- Specified by:
deleteTimersByContainer
in interfaceTimerLocal
-
deleteTimersByApplication
public int deleteTimersByApplication(long applicationId)
- Specified by:
deleteTimersByApplication
in interfaceTimerLocal
-
-