Package com.trilead.ssh2.util
Class TimeoutService
- java.lang.Object
-
- com.trilead.ssh2.util.TimeoutService
-
public class TimeoutService extends java.lang.Object
TimeoutService (beta). Here you can register a timeout.Implemented having large scale programs in mind: if you open many concurrent SSH connections that rely on timeouts, then there will be only one timeout thread. Once all timeouts have expired/are cancelled, the thread will (sooner or later) exit. Only after new timeouts arrive a new thread (singleton) will be instantiated.
- Version:
- $Id: TimeoutService.java,v 1.1 2007/10/15 12:49:57 cplattne Exp $
- Author:
- Christian Plattner, plattner@trilead.com
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
TimeoutService.TimeoutToken
-
Constructor Summary
Constructors Constructor Description TimeoutService(java.lang.String hostname)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TimeoutService.TimeoutToken
addTimeoutHandler(long runTime, java.lang.Runnable handler)
It is assumed that the passed handler will not execute for a long time.void
cancelTimeoutHandler(TimeoutService.TimeoutToken token)
Cancel the timeout callback for the specified token.
-
-
-
Method Detail
-
addTimeoutHandler
public TimeoutService.TimeoutToken addTimeoutHandler(long runTime, java.lang.Runnable handler)
It is assumed that the passed handler will not execute for a long time.- Parameters:
runTime
- runTimehandler
- handler- Returns:
- a TimeoutToken that can be used to cancel the timeout.
-
cancelTimeoutHandler
public void cancelTimeoutHandler(TimeoutService.TimeoutToken token)
Cancel the timeout callback for the specified token.- Parameters:
token
- token to be canceled.
-
-