hudson.remoting
Class PingThread

java.lang.Object
  extended by java.lang.Thread
      extended by hudson.remoting.PingThread
All Implemented Interfaces:
java.lang.Runnable

public abstract class PingThread
extends java.lang.Thread

Periodically perform a ping.

Useful when a connection needs to be kept alive by sending data, or when the disconnection is not properly detected.

onDead() method needs to be overrided to define what to do when a connection appears to be dead.

Since:
1.170
Author:
Kohsuke Kawaguchi

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
PingThread(Channel channel)
           
PingThread(Channel channel, long interval)
           
PingThread(Channel channel, long timeout, long interval)
           
 
Method Summary
protected abstract  void onDead()
          Called when ping failed.
 void run()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PingThread

public PingThread(Channel channel,
                  long timeout,
                  long interval)

PingThread

public PingThread(Channel channel,
                  long interval)

PingThread

public PingThread(Channel channel)
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

onDead

protected abstract void onDead()
Called when ping failed.



Copyright © 2012. All Rights Reserved.