Package com.sun.ejb.containers
Class NonPersistentEJBTimerService
- java.lang.Object
-
- com.sun.ejb.containers.EJBTimerService
-
- com.sun.ejb.containers.NonPersistentEJBTimerService
-
- Direct Known Subclasses:
HazelcastTimerStore
,PersistentEJBTimerService
public class NonPersistentEJBTimerService extends EJBTimerService
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.sun.ejb.containers.EJBTimerService
EJBTimerService.TimerCache
-
-
Field Summary
-
Fields inherited from class com.sun.ejb.containers.EJBTimerService
domainName_, ejbContainerUtil, isDas, ownerIdOfThisServer_, STATE_ACTIVE, STATE_CANCELLED, timerCache_, totalTimedObjectsInitialized_
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
NonPersistentEJBTimerService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
cancelNonPersistentTimer(TimerPrimaryKey timerId)
protected void
cancelTimer(TimerPrimaryKey timerId)
protected void
cancelTimersByKey(long containerId, Object primaryKey)
Cancel all timers associated with a particular entity bean identity.This is typically called when an entity bean is removed.Note that this action falls under the normal EJB Timer removal semantics, which means it can be rolled back if the transaction rolls back.protected Serializable
getInfo(TimerPrimaryKey timerId)
protected Date
getNextTimeout(TimerPrimaryKey timerId)
Return next planned timeout for this timer.We have a fair amount of leeway regarding the consistency of this information.We should strive to detect the case where the timer no longer exists.However, since the current timer instance may not even own this timer, it's difficult to know the exact time of delivery in another server instance.Set<TimerPrimaryKey>
getNonPersistentActiveTimerIdsByThisServer()
protected RuntimeTimerState
getNonPersistentTimer(TimerPrimaryKey timerId)
protected Collection<TimerPrimaryKey>
getTimerIds(long containerId, Object timedObjectPrimaryKey)
Called by EJBTimerServiceWrapper when caller calls getTimers.protected Collection<TimerPrimaryKey>
getTimerIds(Collection<Long> containerIds)
protected EJBTimerSchedule
getTimerSchedule(TimerPrimaryKey timerId)
Called by #getScheduleExpression and #isCalendarTimerprotected boolean
isNonpersistent(TimerPrimaryKey timerId)
Check if timerId represents nonpersistent timer.boolean
isPersistent()
protected boolean
isPersistent(TimerPrimaryKey timerId)
protected boolean
isValidTimerForThisServer(TimerPrimaryKey timerId, RuntimeTimerState timerState)
Non-persistent timers are always valid because to be executed on this server instance.int
migrateTimers(String fromOwnerId)
Called by CLI.Take ownership of another server's timers.protected void
resetEJBTimers(String target)
Called at server startup *after* user apps have been re-activated to restart any active EJB timers or cleanup old timers.No-op for non-persistent timersprotected void
resetLastExpiration(TimerPrimaryKey timerId, RuntimeTimerState timerState)
Nothing special to do for non-persistent timersprotected void
stopTimers(long containerId)
Remove from the cache and stop all timers associated with a particular ejb container and known to this server instance.This is typically called when an ejb is disabled or on a server shutdown to avoid accidentally removing a valid timer.protected boolean
timerExists(TimerPrimaryKey timerId)
-
Methods inherited from class com.sun.ejb.containers.EJBTimerService
_createTimer, _destroyTimers, _getNextTimeout, addTimerSynchronization, addTimerSynchronization, addToSchedules, calcNextFixedRateExpiration, calcNextFixedRateExpiration, cancelTimerSynchronization, cancelTimerSynchronization, createEJBException, createSchedules, createSchedules, createSchedulesOnServer, destroyAllTimers, destroyTimers, enableRescheduleTimers, expungeTimer, getContainer, getEJBTimerService, getEJBTimerService, getEJBTimerService, getEJBTimerService, getEJBTimerServiceWrapper, getMaxRedeliveries, getNextScheduledTimeout, getNonPersistentTimerService, getOwnerIdOfThisServer, getPersistentTimerService, getTimerClassLoader, getTimerState, isCancelledByAnotherInstance, isNonPersistentTimerServiceLoaded, isPersistentTimerServiceLoaded, listTimers, onShutdown, recoverAndCreateSchedules, redeliverTimeout, scheduleTask, setNonPersistentTimerService, setPersistentTimerService, stopOnFailure, stopTimers, timerStateToString
-
-
-
-
Method Detail
-
isPersistent
public boolean isPersistent()
- Specified by:
isPersistent
in classEJBTimerService
-
isNonpersistent
protected boolean isNonpersistent(TimerPrimaryKey timerId) throws jakarta.ejb.FinderException
Check if timerId represents nonpersistent timer. Used by subclasses to determine whether this class would handle the actions on this timer.- Parameters:
timerId
- id of the timer- Returns:
- true if timerId represents valid active timer
- Throws:
jakarta.ejb.FinderException
- if timerId represents expired nonpersistent timer
-
migrateTimers
public int migrateTimers(String fromOwnerId)
Description copied from class:EJBTimerService
Called by CLI.Take ownership of another server's timers.- Specified by:
migrateTimers
in classEJBTimerService
- Returns:
-
cancelTimer
protected void cancelTimer(TimerPrimaryKey timerId) throws jakarta.ejb.FinderException, Exception
- Specified by:
cancelTimer
in classEJBTimerService
- Throws:
jakarta.ejb.FinderException
Exception
-
cancelTimersByKey
protected void cancelTimersByKey(long containerId, Object primaryKey)
Description copied from class:EJBTimerService
Cancel all timers associated with a particular entity bean identity.This is typically called when an entity bean is removed.Note that this action falls under the normal EJB Timer removal semantics, which means it can be rolled back if the transaction rolls back.- Specified by:
cancelTimersByKey
in classEJBTimerService
-
getNextTimeout
protected Date getNextTimeout(TimerPrimaryKey timerId) throws jakarta.ejb.FinderException
Description copied from class:EJBTimerService
Return next planned timeout for this timer.We have a fair amount of leeway regarding the consistency of this information.We should strive to detect the case where the timer no longer exists.However, since the current timer instance may not even own this timer, it's difficult to know the exact time of delivery in another server instance. In the case of single-action timers, we return the expiration time that was provided upon timer creation. For periodic timers, we can derive the next scheduled fixed rate expiration based on the initial expiration and the interval.- Specified by:
getNextTimeout
in classEJBTimerService
- Returns:
- Throws:
jakarta.ejb.FinderException
-
isValidTimerForThisServer
protected boolean isValidTimerForThisServer(TimerPrimaryKey timerId, RuntimeTimerState timerState)
Description copied from class:EJBTimerService
Non-persistent timers are always valid because to be executed on this server instance.- Specified by:
isValidTimerForThisServer
in classEJBTimerService
- Returns:
-
cancelNonPersistentTimer
protected boolean cancelNonPersistentTimer(TimerPrimaryKey timerId) throws jakarta.ejb.FinderException, Exception
- Throws:
jakarta.ejb.FinderException
Exception
-
getNonPersistentActiveTimerIdsByThisServer
public Set<TimerPrimaryKey> getNonPersistentActiveTimerIdsByThisServer()
- Specified by:
getNonPersistentActiveTimerIdsByThisServer
in classEJBTimerService
-
getNonPersistentTimer
protected RuntimeTimerState getNonPersistentTimer(TimerPrimaryKey timerId) throws jakarta.ejb.FinderException
- Throws:
jakarta.ejb.FinderException
-
getTimerSchedule
protected EJBTimerSchedule getTimerSchedule(TimerPrimaryKey timerId) throws jakarta.ejb.FinderException
Description copied from class:EJBTimerService
Called by #getScheduleExpression and #isCalendarTimer- Specified by:
getTimerSchedule
in classEJBTimerService
- Returns:
- Throws:
jakarta.ejb.FinderException
-
isPersistent
protected boolean isPersistent(TimerPrimaryKey timerId) throws jakarta.ejb.FinderException
- Specified by:
isPersistent
in classEJBTimerService
- Throws:
jakarta.ejb.FinderException
-
timerExists
protected boolean timerExists(TimerPrimaryKey timerId)
- Specified by:
timerExists
in classEJBTimerService
-
getInfo
protected Serializable getInfo(TimerPrimaryKey timerId) throws jakarta.ejb.FinderException
- Specified by:
getInfo
in classEJBTimerService
- Throws:
jakarta.ejb.FinderException
-
getTimerIds
protected Collection<TimerPrimaryKey> getTimerIds(Collection<Long> containerIds)
- Specified by:
getTimerIds
in classEJBTimerService
- Parameters:
containerIds
- the EJBs which own the timers- Returns:
- Collection of Timer Ids.
-
getTimerIds
protected Collection<TimerPrimaryKey> getTimerIds(long containerId, Object timedObjectPrimaryKey)
Description copied from class:EJBTimerService
Called by EJBTimerServiceWrapper when caller calls getTimers.- Specified by:
getTimerIds
in classEJBTimerService
- Parameters:
containerId
- the id of the EJB which owns the timerstimedObjectPrimaryKey
- can be null if not entity bean- Returns:
- Collection of Timer Ids.
-
stopTimers
protected void stopTimers(long containerId)
Description copied from class:EJBTimerService
Remove from the cache and stop all timers associated with a particular ejb container and known to this server instance.This is typically called when an ejb is disabled or on a server shutdown to avoid accidentally removing a valid timer. This is also called when an ejb is disabled as part of an undeploy. Removal of the associated timer from the database is done as the last step of undeployment.- Specified by:
stopTimers
in classEJBTimerService
-
resetEJBTimers
protected void resetEJBTimers(String target)
Description copied from class:EJBTimerService
Called at server startup *after* user apps have been re-activated to restart any active EJB timers or cleanup old timers.No-op for non-persistent timers- Specified by:
resetEJBTimers
in classEJBTimerService
-
resetLastExpiration
protected void resetLastExpiration(TimerPrimaryKey timerId, RuntimeTimerState timerState)
Description copied from class:EJBTimerService
Nothing special to do for non-persistent timers- Specified by:
resetLastExpiration
in classEJBTimerService
-
-