IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

com.ibm.btt.cs.html.util
Class ProcessorExpirationCheckManager

java.lang.Object
  extended by java.util.TimerTask
      extended by com.ibm.btt.cs.html.util.ProcessorExpirationCheckManager
All Implemented Interfaces:
java.lang.Runnable

public class ProcessorExpirationCheckManager
extends java.util.TimerTask

This thread has the responsability of find the expired sessions. A session is considered expired as long as has reached a timeout from its last request processed. This timeout is an attribute of the CSServer Service. The thread remains asleep during a given period of time, then performs the check. This process repeats until the stop method is called. The time that the thread will sleep is an attribute of CSServer called timeBetweenSessionCheck. When a session has expired, two actions are performed: marking it as expired, this changing the expired value of the session entry to true, and firing an CSInactivityClientEvent.


Field Summary
protected static CSProcessorInactivityListener aCSProcessorInactivityListener
          Contains the listeners of the CSProcessorInactivityEvent events.
protected static long timeBetweenChecks
          Indicates the thread the time it must sleep between a checking and the next one.
 
Constructor Summary
ProcessorExpirationCheckManager()
           
 
Method Summary
static void addCSProcessorInactivityListener(CSProcessorInactivityListener listener)
          set the CSProcessorInactivityListener
 void checkExpiredSessions()
          When an expired session is found, fire an event and mark the session as expired.
 void fireHandleCSProcessorInactivityEvent(CSProcessorInactivityEvent event)
          fire the CSProcessorInactivityEvent and use the listener to handle it
static void performHouseKeeping(CSProcessorInactivityEvent event)
          remove the processor from the processor manager
 void run()
          Run method of the thread.
static void startExpirationCheckTask(long timeBetweenChecksValue)
          start to check the expired processor
static void stopThread()
          Stops the thread.
 
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

timeBetweenChecks

protected static long timeBetweenChecks
Indicates the thread the time it must sleep between a checking and the next one.


aCSProcessorInactivityListener

protected static transient CSProcessorInactivityListener aCSProcessorInactivityListener
Contains the listeners of the CSProcessorInactivityEvent events.

Constructor Detail

ProcessorExpirationCheckManager

public ProcessorExpirationCheckManager()
Method Detail

addCSProcessorInactivityListener

public static void addCSProcessorInactivityListener(CSProcessorInactivityListener listener)
set the CSProcessorInactivityListener

Parameters:
listener - CSProcessorInactivityListener

startExpirationCheckTask

public static void startExpirationCheckTask(long timeBetweenChecksValue)
start to check the expired processor

Parameters:
timeBetweenChecksValue - the time in milliseconds to check the expired processor

run

public void run()
Run method of the thread. Sleeps for a given time (set in the CSServerService) and calls the Context.checkExpiredSessions method, which will look for expired sessions. Once a expired session is found, it is marked as expired and an event is triggered. If wants to terminate the thread must set the again attribute to false.

Specified by:
run in interface java.lang.Runnable
Specified by:
run in class java.util.TimerTask

stopThread

public static void stopThread()
Stops the thread.


checkExpiredSessions

public void checkExpiredSessions()
                          throws DSEInvalidRequestException,
                                 DSEObjectNotFoundException
When an expired session is found, fire an event and mark the session as expired. Method called from the ExpiredSessionsChecker thread. It is synchronized with the addSession and removeSession methods.

Throws:
DSEInvalidRequestException
DSEObjectNotFoundException

performHouseKeeping

public static void performHouseKeeping(CSProcessorInactivityEvent event)
                                throws DSEInvalidRequestException
remove the processor from the processor manager

Parameters:
event - CSProcessorInactivityEvent
Throws:
DSEInvalidRequestException - if error occurs

fireHandleCSProcessorInactivityEvent

public void fireHandleCSProcessorInactivityEvent(CSProcessorInactivityEvent event)
fire the CSProcessorInactivityEvent and use the listener to handle it

Parameters:
event - CSProcessorInactivityEvent event

IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2009