org.apache.geronimo.timer
Class ThreadPooledTimer

java.lang.Object
  extended by org.apache.geronimo.timer.ThreadPooledTimer
All Implemented Interfaces:
GBeanLifecycle, PersistentTimer
Direct Known Subclasses:
JDBCStoreThreadPooledNonTransactionalTimer, JDBCStoreThreadPooledTransactionalTimer, VMStoreThreadPooledNonTransactionalTimer, VMStoreThreadPooledTransactionalTimer

public class ThreadPooledTimer
extends Object
implements PersistentTimer, GBeanLifecycle


Constructor Summary
ThreadPooledTimer()
           
ThreadPooledTimer(ExecutorTaskFactory executorTaskFactory, WorkerPersistence workerPersistence, Executor executor, TransactionManager transactionManager)
           
 
Method Summary
 void cancelTimerTasks(Collection ids)
          Called when client, eg. ejb container, is stopped and needs to cancel its timertasks without affecting persisted timer data.
 void doFail()
          Fails the GBean.
 void doStart()
          Starts the GBean.
 void doStop()
          Stops the target.
 Collection getIdsByKey(String key, Object userId)
           
 WorkInfo getWorkInfo(Long id)
           
 Collection playback(String key, UserTaskFactory userTaskFactory)
           
 WorkInfo schedule(String key, UserTaskFactory userTaskFactory, Object userInfo, long delay, long period, Object userId)
           
 WorkInfo schedule(String key, UserTaskFactory userTaskFactory, Object userId, Object userInfo, Date time)
           
 WorkInfo schedule(String key, UserTaskFactory userTaskFactory, Object userId, Object userInfo, Date firstTime, long period)
           
 WorkInfo schedule(UserTaskFactory userTaskFactory, String key, Object userId, Object userInfo, long delay)
           
 WorkInfo scheduleAtFixedRate(String key, UserTaskFactory userTaskFactory, Object userId, Object userInfo, Date firstTime, long period)
           
 WorkInfo scheduleAtFixedRate(String key, UserTaskFactory userTaskFactory, Object userId, Object userInfo, long delay, long period)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadPooledTimer

public ThreadPooledTimer()

ThreadPooledTimer

public ThreadPooledTimer(ExecutorTaskFactory executorTaskFactory,
                         WorkerPersistence workerPersistence,
                         Executor executor,
                         TransactionManager transactionManager)
Method Detail

doStart

public void doStart()
             throws Exception
Description copied from interface: GBeanLifecycle
Starts the GBean. This informs the GBean that it is about to transition to the running state.

Specified by:
doStart in interface GBeanLifecycle
Throws:
Exception - if the target failed to start; this will cause a transition to the failed state

doStop

public void doStop()
Description copied from interface: GBeanLifecycle
Stops the target. This informs the GBean that it is about to transition to the stopped state.

Specified by:
doStop in interface GBeanLifecycle

doFail

public void doFail()
Description copied from interface: GBeanLifecycle
Fails the GBean. This informs the GBean that it is about to transition to the failed state.

Specified by:
doFail in interface GBeanLifecycle

schedule

public WorkInfo schedule(UserTaskFactory userTaskFactory,
                         String key,
                         Object userId,
                         Object userInfo,
                         long delay)
                  throws PersistenceException,
                         RollbackException,
                         SystemException
Specified by:
schedule in interface PersistentTimer
Throws:
PersistenceException
RollbackException
SystemException

schedule

public WorkInfo schedule(String key,
                         UserTaskFactory userTaskFactory,
                         Object userId,
                         Object userInfo,
                         Date time)
                  throws PersistenceException,
                         RollbackException,
                         SystemException
Specified by:
schedule in interface PersistentTimer
Throws:
PersistenceException
RollbackException
SystemException

schedule

public WorkInfo schedule(String key,
                         UserTaskFactory userTaskFactory,
                         Object userInfo,
                         long delay,
                         long period,
                         Object userId)
                  throws PersistenceException,
                         RollbackException,
                         SystemException
Specified by:
schedule in interface PersistentTimer
Throws:
PersistenceException
RollbackException
SystemException

schedule

public WorkInfo schedule(String key,
                         UserTaskFactory userTaskFactory,
                         Object userId,
                         Object userInfo,
                         Date firstTime,
                         long period)
                  throws PersistenceException,
                         RollbackException,
                         SystemException
Specified by:
schedule in interface PersistentTimer
Throws:
PersistenceException
RollbackException
SystemException

scheduleAtFixedRate

public WorkInfo scheduleAtFixedRate(String key,
                                    UserTaskFactory userTaskFactory,
                                    Object userId,
                                    Object userInfo,
                                    long delay,
                                    long period)
                             throws PersistenceException,
                                    RollbackException,
                                    SystemException
Specified by:
scheduleAtFixedRate in interface PersistentTimer
Throws:
PersistenceException
RollbackException
SystemException

scheduleAtFixedRate

public WorkInfo scheduleAtFixedRate(String key,
                                    UserTaskFactory userTaskFactory,
                                    Object userId,
                                    Object userInfo,
                                    Date firstTime,
                                    long period)
                             throws PersistenceException,
                                    RollbackException,
                                    SystemException
Specified by:
scheduleAtFixedRate in interface PersistentTimer
Throws:
PersistenceException
RollbackException
SystemException

playback

public Collection playback(String key,
                           UserTaskFactory userTaskFactory)
                    throws PersistenceException
Specified by:
playback in interface PersistentTimer
Throws:
PersistenceException

getIdsByKey

public Collection getIdsByKey(String key,
                              Object userId)
                       throws PersistenceException
Specified by:
getIdsByKey in interface PersistentTimer
Throws:
PersistenceException

getWorkInfo

public WorkInfo getWorkInfo(Long id)
Specified by:
getWorkInfo in interface PersistentTimer

cancelTimerTasks

public void cancelTimerTasks(Collection ids)
Called when client, eg. ejb container, is stopped and needs to cancel its timertasks without affecting persisted timer data.

Specified by:
cancelTimerTasks in interface PersistentTimer
Parameters:
ids - list of ids to have their corresponding workInfo timertasks cancelled.


Copyright © 2003-2007 Apache Software Foundation. All Rights Reserved.