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 protectedNonPersistentEJBTimerService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancancelNonPersistentTimer(TimerPrimaryKey timerId)protected voidcancelTimer(TimerPrimaryKey timerId)protected voidcancelTimersByKey(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 SerializablegetInfo(TimerPrimaryKey timerId)protected DategetNextTimeout(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 RuntimeTimerStategetNonPersistentTimer(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 EJBTimerSchedulegetTimerSchedule(TimerPrimaryKey timerId)Called by #getScheduleExpression and #isCalendarTimerprotected booleanisNonpersistent(TimerPrimaryKey timerId)Check if timerId represents nonpersistent timer.booleanisPersistent()protected booleanisPersistent(TimerPrimaryKey timerId)protected booleanisValidTimerForThisServer(TimerPrimaryKey timerId, RuntimeTimerState timerState)Non-persistent timers are always valid because to be executed on this server instance.intmigrateTimers(String fromOwnerId)Called by CLI.Take ownership of another server's timers.protected voidresetEJBTimers(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 voidresetLastExpiration(TimerPrimaryKey timerId, RuntimeTimerState timerState)Nothing special to do for non-persistent timersprotected voidstopTimers(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 booleantimerExists(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:
isPersistentin 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:EJBTimerServiceCalled by CLI.Take ownership of another server's timers.- Specified by:
migrateTimersin classEJBTimerService- Returns:
-
cancelTimer
protected void cancelTimer(TimerPrimaryKey timerId) throws jakarta.ejb.FinderException, Exception
- Specified by:
cancelTimerin classEJBTimerService- Throws:
jakarta.ejb.FinderExceptionException
-
cancelTimersByKey
protected void cancelTimersByKey(long containerId, Object primaryKey)Description copied from class:EJBTimerServiceCancel 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:
cancelTimersByKeyin classEJBTimerService
-
getNextTimeout
protected Date getNextTimeout(TimerPrimaryKey timerId) throws jakarta.ejb.FinderException
Description copied from class:EJBTimerServiceReturn 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:
getNextTimeoutin classEJBTimerService- Returns:
- Throws:
jakarta.ejb.FinderException
-
isValidTimerForThisServer
protected boolean isValidTimerForThisServer(TimerPrimaryKey timerId, RuntimeTimerState timerState)
Description copied from class:EJBTimerServiceNon-persistent timers are always valid because to be executed on this server instance.- Specified by:
isValidTimerForThisServerin classEJBTimerService- Returns:
-
cancelNonPersistentTimer
protected boolean cancelNonPersistentTimer(TimerPrimaryKey timerId) throws jakarta.ejb.FinderException, Exception
- Throws:
jakarta.ejb.FinderExceptionException
-
getNonPersistentActiveTimerIdsByThisServer
public Set<TimerPrimaryKey> getNonPersistentActiveTimerIdsByThisServer()
- Specified by:
getNonPersistentActiveTimerIdsByThisServerin 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:EJBTimerServiceCalled by #getScheduleExpression and #isCalendarTimer- Specified by:
getTimerSchedulein classEJBTimerService- Returns:
- Throws:
jakarta.ejb.FinderException
-
isPersistent
protected boolean isPersistent(TimerPrimaryKey timerId) throws jakarta.ejb.FinderException
- Specified by:
isPersistentin classEJBTimerService- Throws:
jakarta.ejb.FinderException
-
timerExists
protected boolean timerExists(TimerPrimaryKey timerId)
- Specified by:
timerExistsin classEJBTimerService
-
getInfo
protected Serializable getInfo(TimerPrimaryKey timerId) throws jakarta.ejb.FinderException
- Specified by:
getInfoin classEJBTimerService- Throws:
jakarta.ejb.FinderException
-
getTimerIds
protected Collection<TimerPrimaryKey> getTimerIds(Collection<Long> containerIds)
- Specified by:
getTimerIdsin 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:EJBTimerServiceCalled by EJBTimerServiceWrapper when caller calls getTimers.- Specified by:
getTimerIdsin 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:EJBTimerServiceRemove 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:
stopTimersin classEJBTimerService
-
resetEJBTimers
protected void resetEJBTimers(String target)
Description copied from class:EJBTimerServiceCalled 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:
resetEJBTimersin classEJBTimerService
-
resetLastExpiration
protected void resetLastExpiration(TimerPrimaryKey timerId, RuntimeTimerState timerState)
Description copied from class:EJBTimerServiceNothing special to do for non-persistent timers- Specified by:
resetLastExpirationin classEJBTimerService
-
-