org.apache.openejb.core.timer
Class EjbTimerServiceImpl

java.lang.Object
  extended by org.apache.openejb.core.timer.EjbTimerServiceImpl
All Implemented Interfaces:
Serializable, EjbTimerService

public class EjbTimerServiceImpl
extends Object
implements EjbTimerService, Serializable

See Also:
Serialized Form

Field Summary
static String EJB_TIMER_RETRY_ATTEMPTS
           
static String OPENEJB_QUARTZ_USE_TCCL
           
static String OPENEJB_TIMEOUT_JOB_GROUP_NAME
           
static String OPENEJB_TIMEOUT_JOB_NAME
           
static String QUARTZ_JMX
           
static String QUARTZ_MAKE_SCHEDULER_THREAD_DAEMON
           
 
Constructor Summary
EjbTimerServiceImpl(BeanContext deployment, TimerStore timerStore)
           
EjbTimerServiceImpl(BeanContext deployment, TransactionManager transactionManager, TimerStore timerStore, int retryAttempts)
           
 
Method Summary
 void addTimerData(TimerData timerData)
          Returns a timerData to the TimerStore, if a cancel() is rolled back.
 void cancelled(TimerData timerData)
          Call back from TimerData and ejbTimeout when a timer has been cancelled (or is complete) and should be removed from stores.
 javax.ejb.Timer createTimer(Object primaryKey, Method timeoutMethod, Date initialExpiration, long intervalDuration, javax.ejb.TimerConfig timerConfig)
           
 javax.ejb.Timer createTimer(Object primaryKey, Method timeoutMethod, Date expiration, javax.ejb.TimerConfig timerConfig)
           
 javax.ejb.Timer createTimer(Object primaryKey, Method timeoutMethod, long initialDuration, long intervalDuration, javax.ejb.TimerConfig timerConfig)
           
 javax.ejb.Timer createTimer(Object primaryKey, Method timeoutMethod, long duration, javax.ejb.TimerConfig timerConfig)
           
 javax.ejb.Timer createTimer(Object primaryKey, Method timeoutMethod, javax.ejb.ScheduleExpression scheduleExpression, javax.ejb.TimerConfig timerConfig)
           
 void ejbTimeout(TimerData timerData)
          This method calls the ejbTimeout method and starts a transaction if the timeout is transacted.
static org.apache.openejb.quartz.Scheduler getDefaultScheduler(BeanContext deployment)
           
static TransactionManager getDefaultTransactionManager()
           
 org.apache.openejb.quartz.Scheduler getScheduler()
           
 javax.ejb.Timer getTimer(long timerId)
           
 Collection<javax.ejb.Timer> getTimers(Object primaryKey)
           
 TimerStore getTimerStore()
           
 TransactionManager getTransactionManager()
           
 boolean isStarted()
           
 void schedule(TimerData timerData)
          Called from TimerData and start when a timer should be scheduled with the java.util.Timer.
static void shutdown()
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUARTZ_JMX

public static final String QUARTZ_JMX
See Also:
Constant Field Values

QUARTZ_MAKE_SCHEDULER_THREAD_DAEMON

public static final String QUARTZ_MAKE_SCHEDULER_THREAD_DAEMON
See Also:
Constant Field Values

OPENEJB_TIMEOUT_JOB_NAME

public static final String OPENEJB_TIMEOUT_JOB_NAME
See Also:
Constant Field Values

OPENEJB_TIMEOUT_JOB_GROUP_NAME

public static final String OPENEJB_TIMEOUT_JOB_GROUP_NAME
See Also:
Constant Field Values

EJB_TIMER_RETRY_ATTEMPTS

public static final String EJB_TIMER_RETRY_ATTEMPTS
See Also:
Constant Field Values

OPENEJB_QUARTZ_USE_TCCL

public static final String OPENEJB_QUARTZ_USE_TCCL
See Also:
Constant Field Values
Constructor Detail

EjbTimerServiceImpl

public EjbTimerServiceImpl(BeanContext deployment,
                           TimerStore timerStore)

EjbTimerServiceImpl

public EjbTimerServiceImpl(BeanContext deployment,
                           TransactionManager transactionManager,
                           TimerStore timerStore,
                           int retryAttempts)
Method Detail

getDefaultTransactionManager

public static TransactionManager getDefaultTransactionManager()

getDefaultScheduler

public static org.apache.openejb.quartz.Scheduler getDefaultScheduler(BeanContext deployment)

stop

public void stop()
Specified by:
stop in interface EjbTimerService

shutdown

public static void shutdown()

start

public void start()
           throws TimerStoreException
Specified by:
start in interface EjbTimerService
Throws:
TimerStoreException

getTransactionManager

public TransactionManager getTransactionManager()

schedule

public void schedule(TimerData timerData)
              throws TimerStoreException
Called from TimerData and start when a timer should be scheduled with the java.util.Timer.

Parameters:
timerData - the timer to schedule
Throws:
TimerStoreException

cancelled

public void cancelled(TimerData timerData)
Call back from TimerData and ejbTimeout when a timer has been cancelled (or is complete) and should be removed from stores.

Parameters:
timerData - the timer that was cancelled

addTimerData

public void addTimerData(TimerData timerData)
Returns a timerData to the TimerStore, if a cancel() is rolled back.

Parameters:
timerData - the timer to be returned to the timer store

getTimer

public javax.ejb.Timer getTimer(long timerId)
Specified by:
getTimer in interface EjbTimerService

getTimers

public Collection<javax.ejb.Timer> getTimers(Object primaryKey)
                                      throws IllegalStateException
Specified by:
getTimers in interface EjbTimerService
Throws:
IllegalStateException

createTimer

public javax.ejb.Timer createTimer(Object primaryKey,
                                   Method timeoutMethod,
                                   long duration,
                                   javax.ejb.TimerConfig timerConfig)
                            throws IllegalArgumentException,
                                   IllegalStateException,
                                   javax.ejb.EJBException
Specified by:
createTimer in interface EjbTimerService
Throws:
IllegalArgumentException
IllegalStateException
javax.ejb.EJBException

createTimer

public javax.ejb.Timer createTimer(Object primaryKey,
                                   Method timeoutMethod,
                                   long initialDuration,
                                   long intervalDuration,
                                   javax.ejb.TimerConfig timerConfig)
                            throws IllegalArgumentException,
                                   IllegalStateException,
                                   javax.ejb.EJBException
Specified by:
createTimer in interface EjbTimerService
Throws:
IllegalArgumentException
IllegalStateException
javax.ejb.EJBException

createTimer

public javax.ejb.Timer createTimer(Object primaryKey,
                                   Method timeoutMethod,
                                   Date expiration,
                                   javax.ejb.TimerConfig timerConfig)
                            throws IllegalArgumentException,
                                   IllegalStateException,
                                   javax.ejb.EJBException
Specified by:
createTimer in interface EjbTimerService
Throws:
IllegalArgumentException
IllegalStateException
javax.ejb.EJBException

createTimer

public javax.ejb.Timer createTimer(Object primaryKey,
                                   Method timeoutMethod,
                                   Date initialExpiration,
                                   long intervalDuration,
                                   javax.ejb.TimerConfig timerConfig)
                            throws IllegalArgumentException,
                                   IllegalStateException,
                                   javax.ejb.EJBException
Specified by:
createTimer in interface EjbTimerService
Throws:
IllegalArgumentException
IllegalStateException
javax.ejb.EJBException

createTimer

public javax.ejb.Timer createTimer(Object primaryKey,
                                   Method timeoutMethod,
                                   javax.ejb.ScheduleExpression scheduleExpression,
                                   javax.ejb.TimerConfig timerConfig)
Specified by:
createTimer in interface EjbTimerService

getTimerStore

public TimerStore getTimerStore()
Specified by:
getTimerStore in interface EjbTimerService

isStarted

public boolean isStarted()
Specified by:
isStarted in interface EjbTimerService

getScheduler

public org.apache.openejb.quartz.Scheduler getScheduler()

ejbTimeout

public void ejbTimeout(TimerData timerData)
This method calls the ejbTimeout method and starts a transaction if the timeout is transacted.

This method will retry failed ejbTimeout calls until retryAttempts is exceeded.

Parameters:
timerData - the timer to call.


Copyright © 1999–2015 The Apache Software Foundation. All rights reserved.