com.funambol.push
Class CTPService.ConnectionTimer

java.lang.Object
  extended by java.util.TimerTask
      extended by com.funambol.push.CTPService.ConnectionTimer
All Implemented Interfaces:
java.lang.Runnable
Enclosing class:
CTPService

protected class CTPService.ConnectionTimer
extends java.util.TimerTask

This class is used (with a Timer) to monitor a connection and interrupt it if it hangs for more than command timeout. For each IO operation to be monitored, one such object must be created. The client is responsible for notifying when the operation is terminated. If by the time the alarm is triggered, the operation is not terminated, then such an operation is considered timeout and closeConnection is invoked. This will cause exceptions in any hanging read/write, allowing each thread to resume execution.


Constructor Summary
CTPService.ConnectionTimer()
          Constructor.
 
Method Summary
 void endOperation()
          Notifies the ConnectionTimer that the IO operation has terminated.
 int getDelay()
          Returns the delay for this task
 void run()
          This method is invoked when the alarm expires.
 
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

CTPService.ConnectionTimer

public CTPService.ConnectionTimer()
Constructor. The delay is specified in the Configuration

Method Detail

endOperation

public void endOperation()
Notifies the ConnectionTimer that the IO operation has terminated. Whenever the alarm will be triggered it won't cause a timeout because the operation is finished.


getDelay

public int getDelay()
Returns the delay for this task


run

public void run()
This method is invoked when the alarm expires. If the operation this task is monitoring has not finished yet, then we force the entire connection to shut down. This will cause exceptions for all the pending read/write operations

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


Copyright © 2001-2009 Funambol.