com.sleepycat.je.rep.impl.node
Class ChannelTimeoutTask

java.lang.Object
  extended by java.util.TimerTask
      extended by com.sleepycat.je.rep.impl.node.ChannelTimeoutTask
All Implemented Interfaces:
Runnable

public class ChannelTimeoutTask
extends TimerTask

The ChannelTimeoutTask ensures that all channels registered with it are periodically checked to ensure that they are active. The period roughly corresponds to a second, although intervening GC activity may expand this period considerably. Note that elapsedMs used for timeouts is always ticked up in 1 second increments. Thus multiple seconds of real time may correspond to a single second of "timer time" if the system is paricularly busy, or the gc has been particularly active. This property allows the underlying timeout implementation to compensate for GC pauses in which activity on the channel at the java level would have been suspended and thus reduces the number of false timeouts.


Constructor Summary
ChannelTimeoutTask(Timer timer)
          Creates and schedules the timer task.
 
Method Summary
 void register(NamedChannelWithTimeout channel)
          Registers a channel so that the timer can make periodic calls to isActive().
 void run()
          Runs once a second checking to see if a channel is still active.
 
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
 

Constructor Detail

ChannelTimeoutTask

ChannelTimeoutTask(Timer timer)
Creates and schedules the timer task.

Parameters:
timer - the timer associated with this task
Method Detail

run

public void run()
Runs once a second checking to see if a channel is still active. Each channel establishes its own timeout period using elapsedMs to check for timeouts. Inactive channels are removed from the list of registered channels.

Specified by:
run in interface Runnable
Specified by:
run in class TimerTask

register

public void register(NamedChannelWithTimeout channel)
Registers a channel so that the timer can make periodic calls to isActive(). Note that closing a channel renders it inactive and causes it to be removed from the list by the run() method. Consequently, there is no corresponding unregister operation.

Parameters:
channel - the channel being registered.


Copyright (c) 2004-2010 Oracle. All rights reserved.