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
  • Constructor Details

    • PingThread

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

      public PingThread(Channel channel, long interval)
    • PingThread

      public PingThread(Channel channel)
  • Method Details

    • run

      public void run()
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
    • onDead

      @Deprecated protected abstract void onDead()
      Deprecated.
      as of 2.9 Override onDead(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