bitronix.tm.timer
Class TaskScheduler

java.lang.Object
  extended by java.lang.Thread
      extended by bitronix.tm.timer.TaskScheduler
All Implemented Interfaces:
Service, Runnable

public class TaskScheduler
extends Thread
implements Service

Timed tasks service.

Author:
lorban

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
TaskScheduler()
           
 
Method Summary
 void cancelPoolShrinking(XAPool xaPool)
          Cancel the task that will tell a XA pool to close idle connections.
 void cancelRecovery(Recoverer recoverer)
          Cancel the task that will run background recovery at the specified date.
 void cancelTransactionTimeout(BitronixTransaction transaction)
          Cancel the task that will mark the transaction as timed out at the specified date.
 int countTasksQueued()
          Get the amount of tasks currently queued.
 void run()
           
 void schedulePoolShrinking(XAPool xaPool)
          Schedule a task that will tell a XA pool to close idle connections.
 void scheduleRecovery(Recoverer recoverer, Date executionTime)
          Schedule a task that will run background recovery at the specified date.
 void scheduleTransactionTimeout(BitronixTransaction transaction, Date executionTime)
          Schedule a task that will mark the transaction as timed out at the specified date.
 void shutdown()
          Shutdown the service and free all held resources.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TaskScheduler

public TaskScheduler()
Method Detail

countTasksQueued

public int countTasksQueued()
Get the amount of tasks currently queued.

Returns:
the amount of tasks currently queued.

shutdown

public void shutdown()
Description copied from interface: Service
Shutdown the service and free all held resources.

Specified by:
shutdown in interface Service

scheduleTransactionTimeout

public void scheduleTransactionTimeout(BitronixTransaction transaction,
                                       Date executionTime)
Schedule a task that will mark the transaction as timed out at the specified date. If this method is called with the same transaction multiple times, the previous timeout date is dropped and replaced by the new one.

Parameters:
transaction - the transaction to mark as timeout.
executionTime - the date at which the transaction must be marked.

cancelTransactionTimeout

public void cancelTransactionTimeout(BitronixTransaction transaction)
Cancel the task that will mark the transaction as timed out at the specified date.

Parameters:
transaction - the transaction to mark as timeout.

scheduleRecovery

public void scheduleRecovery(Recoverer recoverer,
                             Date executionTime)
Schedule a task that will run background recovery at the specified date.

Parameters:
recoverer - the recovery implementation to use.
executionTime - the date at which the transaction must be marked.

cancelRecovery

public void cancelRecovery(Recoverer recoverer)
Cancel the task that will run background recovery at the specified date.

Parameters:
recoverer - the recovery implementation to use.

schedulePoolShrinking

public void schedulePoolShrinking(XAPool xaPool)
Schedule a task that will tell a XA pool to close idle connections. The execution time will be provided by the XA pool itself via the XAPool.getNextShrinkDate().

Parameters:
xaPool - the XA pool to notify.

cancelPoolShrinking

public void cancelPoolShrinking(XAPool xaPool)
Cancel the task that will tell a XA pool to close idle connections.

Parameters:
xaPool - the XA pool to notify.

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread


Copyright © 2006-2013 Bitronix Software. All Rights Reserved.