org.apache.geronimo.timer
Class ThreadPooledTimer

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

public class ThreadPooledTimer
extends Object
implements PersistentTimer, org.apache.geronimo.gbean.GBeanLifecycle


Constructor Summary
ThreadPooledTimer()
           
ThreadPooledTimer(ExecutorTaskFactory executorTaskFactory, WorkerPersistence workerPersistence, edu.emory.mathcs.backport.java.util.concurrent.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()
           
 void doStart()
           
 void doStop()
           
 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,
                         edu.emory.mathcs.backport.java.util.concurrent.Executor executor,
                         TransactionManager transactionManager)
Method Detail

doStart

public void doStart()
             throws Exception
Specified by:
doStart in interface org.apache.geronimo.gbean.GBeanLifecycle
Throws:
Exception

doStop

public void doStop()
Specified by:
doStop in interface org.apache.geronimo.gbean.GBeanLifecycle

doFail

public void doFail()
Specified by:
doFail in interface org.apache.geronimo.gbean.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 © 2006 Apache Software Foundation. All Rights Reserved.