public class EJBTimerService extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
EJBTimerService.TimerCache |
| Modifier and Type | Field and Description |
|---|---|
protected String |
domainName_ |
protected EjbContainerUtil |
ejbContainerUtil |
protected boolean |
isDas |
protected String |
ownerIdOfThisServer_ |
static int |
STATE_ACTIVE |
static int |
STATE_CANCELLED |
protected EJBTimerService.TimerCache |
timerCache_ |
protected long |
totalTimedObjectsInitialized_ |
| Modifier | Constructor and Description |
|---|---|
protected |
EJBTimerService() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
_createTimer(TimerPrimaryKey timerId,
long containerId,
long applicationId,
Object timedObjectPrimaryKey,
String server_name,
Date initialExpiration,
long intervalDuration,
EJBTimerSchedule schedule,
javax.ejb.TimerConfig timerConfig) |
protected void |
_destroyTimers(long id,
boolean all) |
protected Date |
_getNextTimeout(RuntimeTimerState rt)
Non-persistent part of the implementation of the getNextTimeout() call
|
void |
addTimerSynchronization(EJBContextImpl context_,
String timerId,
Date initialExpiration,
long containerId,
String ownerId) |
void |
addTimerSynchronization(EJBContextImpl context_,
String timerId,
Date initialExpiration,
long containerId,
String ownerId,
boolean persistent) |
protected void |
addToSchedules(long containerId,
TimerPrimaryKey timerId,
EJBTimerSchedule ts) |
protected Date |
calcNextFixedRateExpiration(Date initialExpiration,
long intervalDuration) |
protected Date |
calcNextFixedRateExpiration(RuntimeTimerState timerState) |
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.
|
void |
cancelTimerSynchronization(EJBContextImpl context_,
TimerPrimaryKey timerId,
long containerId,
String ownerId) |
protected javax.ejb.EJBException |
createEJBException(Exception ex)
Create EJBException using the exception that is passed in
|
protected void |
createSchedules(long containerId,
long applicationId,
Map<?,List<ScheduledTimerDescriptor>> schedules,
Map<TimerPrimaryKey,Method> result,
String server_name,
boolean startTimers,
boolean deploy)
Create automatic timers defined by the @Schedule annotation on the EJB bean.
|
void |
createSchedules(long containerId,
long applicationId,
Map<MethodDescriptor,List<ScheduledTimerDescriptor>> methodDescriptorSchedules,
String server_name)
Create automatic timers defined by the @Schedule annotation on the EJB bean during
deployment to a cluster or the first create-application-ref call after deployment
to DAS only.
|
void |
createSchedulesOnServer(EjbDescriptor ejbDescriptor,
String server_name)
Called in a clustered environment to eagerly create automatic persistent timers
on the specific server instance.
|
void |
destroyAllTimers(long applicationId)
Destroy all timers associated with a particular application.
|
void |
destroyTimers(long containerId)
Destroy all timers associated with a particular ejb container
This is typically called when an ejb is undeployed.
|
protected void |
expungeTimer(TimerPrimaryKey timerId,
boolean removeTimerBean)
Remove all traces of a timer.
|
protected BaseContainer |
getContainer(long containerId) |
static EJBTimerService |
getEJBTimerService() |
static EJBTimerService |
getEJBTimerService(String target) |
static EJBTimerService |
getEJBTimerService(String target,
boolean force) |
protected Serializable |
getInfo(TimerPrimaryKey timerId) |
protected long |
getMaxRedeliveries() |
protected Date |
getNextScheduledTimeout(EJBTimerSchedule ts)
Returns next schedule-based timeout or null if such schedule will
not expire again.
|
protected Date |
getNextTimeout(TimerPrimaryKey timerId)
Return next planned timeout for this timer.
|
Set<TimerPrimaryKey> |
getNonPersistentActiveTimerIdsByThisServer() |
protected RuntimeTimerState |
getNonPersistentTimer(TimerPrimaryKey timerId) |
String |
getOwnerIdOfThisServer()
Return the ownerId of the server instance in
which we are running.
|
ClassLoader |
getTimerClassLoader(long containerId)
Get the application class loader for the timed object
that created a given timer.
|
protected Collection<TimerPrimaryKey> |
getTimerIds(Collection<Long> containerIds) |
protected Collection<TimerPrimaryKey> |
getTimerIds(long containerId,
Object timedObjectPrimaryKey)
Called by EJBTimerServiceWrapper when caller calls getTimers.
|
protected EJBTimerSchedule |
getTimerSchedule(TimerPrimaryKey timerId)
Called by #getScheduleExpression and #isCalendarTimer
|
protected RuntimeTimerState |
getTimerState(TimerPrimaryKey timerId) |
static EJBTimerService |
getValidEJBTimerService() |
protected boolean |
isCancelledByAnotherInstance(RuntimeTimerState timerState)
For a non-persistent timer, it's not possible to be cancelled by another
server instance
|
static boolean |
isEJBTimerServiceLoaded() |
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.
|
String[] |
listTimers(String[] serverIds)
Provide a count of timers owned by each server.
|
int |
migrateTimers(String fromOwnerId)
Called by CLI.
|
static void |
onShutdown()
Called from TimerBean PreDestroy
|
protected Map<TimerPrimaryKey,Method> |
recoverAndCreateSchedules(long containerId,
long applicationId,
Map<Method,List<ScheduledTimerDescriptor>> schedules,
boolean deploy)
Create automatic non-persistent timers defined by the @Schedule
annotation on the EJB bean.
|
protected boolean |
redeliverTimeout(RuntimeTimerState timerState) |
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.
|
protected void |
resetLastExpiration(TimerPrimaryKey timerId,
RuntimeTimerState timerState)
Nothing special to do for non-persistent timers
|
protected void |
scheduleTask(TimerPrimaryKey timerId,
Date expiration) |
protected static void |
setEJBTimerService(EJBTimerService es) |
protected boolean |
stopOnFailure() |
protected void |
stopTimers(long containerId)
Remove from the cache and stop all timers associated with a particular ejb container
and known to this server instance.
|
protected void |
stopTimers(Set<TimerPrimaryKey> timerIds) |
protected boolean |
timerExists(TimerPrimaryKey timerId) |
static String |
timerStateToString(int state) |
protected EjbContainerUtil ejbContainerUtil
protected String domainName_
protected boolean isDas
protected String ownerIdOfThisServer_
protected EJBTimerService.TimerCache timerCache_
protected long totalTimedObjectsInitialized_
public static final int STATE_ACTIVE
public static final int STATE_CANCELLED
protected static void setEJBTimerService(EJBTimerService es)
public static EJBTimerService getEJBTimerService()
public static EJBTimerService getValidEJBTimerService()
public static boolean isEJBTimerServiceLoaded()
public static EJBTimerService getEJBTimerService(String target)
public static EJBTimerService getEJBTimerService(String target, boolean force)
public String getOwnerIdOfThisServer()
public String[] listTimers(String[] serverIds)
public int migrateTimers(String fromOwnerId)
protected javax.ejb.EJBException createEJBException(Exception ex)
protected void resetEJBTimers(String target)
protected void addToSchedules(long containerId,
TimerPrimaryKey timerId,
EJBTimerSchedule ts)
public void destroyTimers(long containerId)
public void destroyAllTimers(long applicationId)
protected void _destroyTimers(long id,
boolean all)
protected void stopTimers(long containerId)
protected void stopTimers(Set<TimerPrimaryKey> timerIds)
protected void scheduleTask(TimerPrimaryKey timerId, Date expiration)
protected Date calcNextFixedRateExpiration(RuntimeTimerState timerState)
protected Date calcNextFixedRateExpiration(Date initialExpiration, long intervalDuration)
protected void expungeTimer(TimerPrimaryKey timerId, boolean removeTimerBean)
protected void _createTimer(TimerPrimaryKey timerId, long containerId, long applicationId, Object timedObjectPrimaryKey, String server_name, Date initialExpiration, long intervalDuration, EJBTimerSchedule schedule, javax.ejb.TimerConfig timerConfig) throws Exception
timedObjectPrimaryKey - can be null if timed object is not an entity bean.Exceptionprotected Map<TimerPrimaryKey,Method> recoverAndCreateSchedules(long containerId, long applicationId, Map<Method,List<ScheduledTimerDescriptor>> schedules, boolean deploy)
public void createSchedulesOnServer(EjbDescriptor ejbDescriptor, String server_name)
public void createSchedules(long containerId,
long applicationId,
Map<MethodDescriptor,List<ScheduledTimerDescriptor>> methodDescriptorSchedules,
String server_name)
protected void createSchedules(long containerId,
long applicationId,
Map<?,List<ScheduledTimerDescriptor>> schedules,
Map<TimerPrimaryKey,Method> result,
String server_name,
boolean startTimers,
boolean deploy)
throws Exception
Exceptionprotected Collection<TimerPrimaryKey> getTimerIds(long containerId, Object timedObjectPrimaryKey)
containerId - the id of the EJB which owns the timerstimedObjectPrimaryKey - can be null if not entity beanprotected Collection<TimerPrimaryKey> getTimerIds(Collection<Long> containerIds)
containerIds - the EJBs which own the timerspublic ClassLoader getTimerClassLoader(long containerId)
protected RuntimeTimerState getTimerState(TimerPrimaryKey timerId)
public Set<TimerPrimaryKey> getNonPersistentActiveTimerIdsByThisServer()
protected void cancelTimersByKey(long containerId,
Object primaryKey)
protected void cancelTimer(TimerPrimaryKey timerId) throws javax.ejb.FinderException, Exception
javax.ejb.FinderExceptionExceptionprotected boolean cancelNonPersistentTimer(TimerPrimaryKey timerId) throws javax.ejb.FinderException, Exception
javax.ejb.FinderExceptionExceptionprotected Date getNextTimeout(TimerPrimaryKey timerId) throws javax.ejb.FinderException
javax.ejb.FinderExceptionprotected Date _getNextTimeout(RuntimeTimerState rt)
protected Serializable getInfo(TimerPrimaryKey timerId) throws javax.ejb.FinderException
javax.ejb.FinderExceptionprotected boolean isPersistent(TimerPrimaryKey timerId) throws javax.ejb.FinderException
javax.ejb.FinderExceptionprotected boolean timerExists(TimerPrimaryKey timerId)
protected EJBTimerSchedule getTimerSchedule(TimerPrimaryKey timerId) throws javax.ejb.FinderException
javax.ejb.FinderExceptionprotected RuntimeTimerState getNonPersistentTimer(TimerPrimaryKey timerId) throws javax.ejb.FinderException
javax.ejb.FinderExceptionprotected BaseContainer getContainer(long containerId)
protected boolean isCancelledByAnotherInstance(RuntimeTimerState timerState)
protected boolean redeliverTimeout(RuntimeTimerState timerState)
protected boolean stopOnFailure()
protected boolean isValidTimerForThisServer(TimerPrimaryKey timerId, RuntimeTimerState timerState)
protected void resetLastExpiration(TimerPrimaryKey timerId, RuntimeTimerState timerState)
protected long getMaxRedeliveries()
public void addTimerSynchronization(EJBContextImpl context_, String timerId, Date initialExpiration, long containerId, String ownerId) throws Exception
Exceptionpublic void addTimerSynchronization(EJBContextImpl context_, String timerId, Date initialExpiration, long containerId, String ownerId, boolean persistent) throws Exception
Exceptionpublic void cancelTimerSynchronization(EJBContextImpl context_, TimerPrimaryKey timerId, long containerId, String ownerId) throws Exception
Exceptionprotected Date getNextScheduledTimeout(EJBTimerSchedule ts)
public boolean isPersistent()
public static void onShutdown()
public static String timerStateToString(int state)
Copyright © 2017. All rights reserved.