Skip navigation links

Oracle® Coherence Java API Reference
Release 3.6.0.0

E15725-01


com.tangosol.coherence.servlet
Class SessionHelper.SessionReaperDaemon

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.util.Daemon
          extended by com.tangosol.util.TaskDaemon
              extended by com.tangosol.coherence.servlet.SessionHelper.SessionReaperDaemon

All Implemented Interfaces:
SessionReaperStatistics, Guardable, Runnable
Enclosing class:
SessionHelper

public class SessionHelper.SessionReaperDaemon
extends TaskDaemon
implements SessionReaperStatistics

A daemon thread class that will clean up expired sessions.


Nested Class Summary
 class SessionHelper.SessionReaperDaemon.IncrementalReapTask
           
 class SessionHelper.SessionReaperDaemon.StartReapingTask
          A task that starts a reaping cycle.

 

Nested classes/interfaces inherited from class com.tangosol.util.TaskDaemon
TaskDaemon.PeriodicTask

 

Nested classes/interfaces inherited from class com.tangosol.util.Daemon
Daemon.DaemonWorker

 

Constructor Summary
SessionHelper.SessionReaperDaemon(String sName, int nPriority)
          Construct a SessionReaperDaemon.

 

Method Summary
 long getAverageReapDuration()
          Gets the average reap duration since the statistics was reset.
 long getAverageReapedSessions()
          Gets the average number of reaped sessions in a reap cycle since the statistics was reset.
 int getEstimatedReaperSessionCount()
          Determine the estimated number of sessions that will be reaped by the reaper when it runs next.
 long getLastReapDuration()
          Gets the duration for the last reap cycle.
 long getLastReapTime()
          Determine the last time that session reaping started.
 long getMaxReapDuration()
          Gets the maximum reap duration since the statistics was reset.
 long getMaxReapedSessions()
          Gets the maximum number of sessions reaped in a reap cycle since the statistics was reset.
 long getNextReapTime()
          Gets the start time for the next reap cycle.
 long getReapedSessions()
          Gets the number of sessions that were reaped during the last reap cycle.
 int getTotalReapCycles()
          Determine the total number of reaping cycles that this node has performed.
 long getTotalReapedSessions()
          Gets the number of sessions that were reaped since the statistics was reset.
 void incTotalReapCycles()
          Increment the total number of reaping cycles that this node has performed.
 SessionHelper.SessionReaperDaemon.StartReapingTask instantiateStartReapingTask()
          Factory method: Instantiate a task that starts a reaping cycle.
protected  boolean isFullReapDue()
          Determine if this node should run a full reaper scan.
protected  void onException(Throwable e, Runnable task)
          Process an exception that is thrown during a task execution.
 void resetStatistics()
          Resets the statistics held by this object.
 void run()
          The task process: Process a portion of the reaping cycle.
 void scheduleTask(Runnable task, long ldt)
          Schedule a task to be run at the specified time, or as soon after as possible.
 void setEstimatedReaperSessionCount(int c)
          Update the estimated number of sessions that will be reaped by the reaper when it runs next.
 void setLastReapDuration(long time)
          Sets the duration for the last reap cycle.
 void setLastReapTime(long dt)
          Update the last time that session reaping started.
 void setNextReapTime(long d)
          Sets the start time for the next reap cycle.
 void setReapedSessions(long l)
          Sets the number of sessions that were reaped during the last reap cycle.

 

Methods inherited from class com.tangosol.util.TaskDaemon
executePeriodicTask, executeTask, getDescription, getIdleTimeout, getMostRecentTaskTime, getTasks, instantiatePeriodicTask, isFinishing, run, schedulePeriodicTask, setFinishing, setIdleTimeout, stop, takeNextRipeTask, toString, updateMostRecentTaskTime

 

Methods inherited from class com.tangosol.util.Daemon
changeState, configureWorker, finishStarting, finishStopping, getConfiguredName, getConfiguredPriority, getContext, getGuardRegisterAction, getMaxWaitMillis, getState, getThread, getThreadContextClassLoader, getWorker, guardIfNeeded, heartbeat, heartbeat, instantiateWorker, isGuarded, isOnWorkerThread, isRunning, isStopping, recover, setConfiguredName, setConfiguredPriority, setContext, setGuardPolicy, setGuardRegisterAction, setThreadContextClassLoader, shutdown, start, stop, terminate, toStateString

 

Constructor Detail

SessionHelper.SessionReaperDaemon

public SessionHelper.SessionReaperDaemon(String sName,
                                         int nPriority)
Construct a SessionReaperDaemon.
Parameters:
sName - the daemon name
nPriority - the daemon priority

Method Detail

scheduleTask

public void scheduleTask(Runnable task,
                         long ldt)
Schedule a task to be run at the specified time, or as soon after as possible.
Overrides:
scheduleTask in class TaskDaemon
Parameters:
task - a Runnable object to invoke
ldt - a datetime value at which to run the task

run

public void run()
The task process: Process a portion of the reaping cycle.
Specified by:
run in interface Runnable
Overrides:
run in class TaskDaemon
See Also:
Thread.run()

onException

protected void onException(Throwable e,
                           Runnable task)
Process an exception that is thrown during a task execution. The default implementation logs the exception and continues.
Overrides:
onException in class TaskDaemon
Parameters:
e - Throwable object (a RuntimeException or an Error)
task - the task that caused the exception

getEstimatedReaperSessionCount

public int getEstimatedReaperSessionCount()
Determine the estimated number of sessions that will be reaped by the reaper when it runs next.
Returns:
an estimate of the number of sessions to reap (if it cannot be determined exactly)

setEstimatedReaperSessionCount

public void setEstimatedReaperSessionCount(int c)
Update the estimated number of sessions that will be reaped by the reaper when it runs next.
Parameters:
c - the number of sessions that were reaped by the previous reap cycle

getTotalReapCycles

public int getTotalReapCycles()
Determine the total number of reaping cycles that this node has performed.
Returns:
the total number of reaping cycles that this node has performed

incTotalReapCycles

public void incTotalReapCycles()
Increment the total number of reaping cycles that this node has performed.

isFullReapDue

protected boolean isFullReapDue()
Determine if this node should run a full reaper scan. This method is only utilized if reaping is cluster-coordinated.
Returns:
true if a reaper scan is due and this node has been selected to perform it

getLastReapDuration

public long getLastReapDuration()
Gets the duration for the last reap cycle.
Specified by:
getLastReapDuration in interface SessionReaperStatistics
Returns:
The duration in milliseconds.

setLastReapDuration

public void setLastReapDuration(long time)
Sets the duration for the last reap cycle.
Specified by:
setLastReapDuration in interface SessionReaperStatistics
Parameters:
time - The duration in milliseconds.

getReapedSessions

public long getReapedSessions()
Gets the number of sessions that were reaped during the last reap cycle.
Specified by:
getReapedSessions in interface SessionReaperStatistics
Returns:
The number of sessions.

setReapedSessions

public void setReapedSessions(long l)
Sets the number of sessions that were reaped during the last reap cycle.
Specified by:
setReapedSessions in interface SessionReaperStatistics
Parameters:
l - The number of sessions.

getTotalReapedSessions

public long getTotalReapedSessions()
Gets the number of sessions that were reaped since the statistics was reset. Note! This attribute doesn't have a setter since it is derived from the ReapedSession attr.
Specified by:
getTotalReapedSessions in interface SessionReaperStatistics
Returns:
The number of sessions.

getLastReapTime

public long getLastReapTime()
Determine the last time that session reaping started.
Specified by:
getLastReapTime in interface SessionReaperStatistics
Returns:
the last time that session reaping started

setLastReapTime

public void setLastReapTime(long dt)
Update the last time that session reaping started.
Specified by:
setLastReapTime in interface SessionReaperStatistics
Parameters:
dt - the last time that session reaping started

getNextReapTime

public long getNextReapTime()
Gets the start time for the next reap cycle.
Specified by:
getNextReapTime in interface SessionReaperStatistics
Returns:
The time in milliseconds when the next reap cycle is schedule to start.

setNextReapTime

public void setNextReapTime(long d)
Sets the start time for the next reap cycle.
Specified by:
setNextReapTime in interface SessionReaperStatistics
Parameters:
d - The time in milliseconds when the next reap cycle is schedule to start.

getAverageReapDuration

public long getAverageReapDuration()
Gets the average reap duration since the statistics was reset.
Specified by:
getAverageReapDuration in interface SessionReaperStatistics
Returns:
The average reap duration.

getAverageReapedSessions

public long getAverageReapedSessions()
Gets the average number of reaped sessions in a reap cycle since the statistics was reset.
Specified by:
getAverageReapedSessions in interface SessionReaperStatistics
Returns:
The average number of reaped sessions.

getMaxReapDuration

public long getMaxReapDuration()
Gets the maximum reap duration since the statistics was reset.
Specified by:
getMaxReapDuration in interface SessionReaperStatistics
Returns:
The max reap duration.

getMaxReapedSessions

public long getMaxReapedSessions()
Gets the maximum number of sessions reaped in a reap cycle since the statistics was reset.
Specified by:
getMaxReapedSessions in interface SessionReaperStatistics
Returns:
The max number of sessions reaped.

resetStatistics

public void resetStatistics()
Resets the statistics held by this object.
Specified by:
resetStatistics in interface SessionReaperStatistics

instantiateStartReapingTask

public SessionHelper.SessionReaperDaemon.StartReapingTask instantiateStartReapingTask()
Factory method: Instantiate a task that starts a reaping cycle.

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.6.0.0

E15725-01


Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.