public class

TimeoutService

extends Object
java.lang.Object
   ↳ com.trilead.ssh2.util.TimeoutService

Class Overview

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.

Summary

Nested Classes
class TimeoutService.TimeoutToken  
Fields
private static final Logger log
private static Thread timeoutThread
private static final LinkedList todolist
Public Constructors
TimeoutService()
Public Methods
final static TimeoutService.TimeoutToken addTimeoutHandler(long runTime, Runnable handler)
It is assumed that the passed handler will not execute for a long time.
final static void cancelTimeoutHandler(TimeoutService.TimeoutToken token)
[Expand]
Inherited Methods
From class java.lang.Object

Fields

private static final Logger log

private static Thread timeoutThread

private static final LinkedList todolist

Public Constructors

public TimeoutService ()

Public Methods

public static final TimeoutService.TimeoutToken addTimeoutHandler (long runTime, Runnable handler)

It is assumed that the passed handler will not execute for a long time.

Parameters
runTime
handler
Returns
  • a TimeoutToken that can be used to cancel the timeout.

public static final void cancelTimeoutHandler (TimeoutService.TimeoutToken token)

Parameters
token