Package hudson.remoting
Class PingThread
- java.lang.Object
-
- java.lang.Thread
-
- hudson.remoting.PingThread
-
- All Implemented Interfaces:
Runnable
public abstract class PingThread extends 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 overridden 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
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description PingThread(Channel channel)
PingThread(Channel channel, long interval)
PingThread(Channel channel, long timeout, long interval)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected abstract void
onDead()
Deprecated.as of 2.9 OverrideonDead(Throwable)
to receive the cause, but also override this method and provide a fallback behaviour to be backward compatible with earlier version of remoting library.protected void
onDead(Throwable diagnosis)
Called when ping failed.void
run()
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Method Detail
-
onDead
@Deprecated protected abstract void onDead()
Deprecated.as of 2.9 OverrideonDead(Throwable)
to receive the cause, but also override this method and provide a fallback behaviour to be backward compatible with earlier version of remoting library.Called when ping failed.
-
onDead
protected void onDead(Throwable diagnosis)
Called when ping failed.- Since:
- 2.9
-
-