Class HeartbeatThread

  • All Implemented Interfaces:
    Runnable

    public final class HeartbeatThread
    extends DirectoryThread
    This thread publishes a HeartbeatMsg on a given protocol session at regular intervals when there are no other replication messages being published.

    These heartbeat messages are sent by a replication server.

    • Constructor Detail

      • HeartbeatThread

        public HeartbeatThread​(String threadName,
                               Session session,
                               long heartbeatInterval)
        Create a heartbeat thread.
        Parameters:
        threadName - The name of the heartbeat thread.
        session - The session on which heartbeats are to be sent.
        heartbeatInterval - The desired interval between heartbeats in milliseconds.
    • Method Detail

      • run

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

        public void shutdown()
        Call this method to stop the thread. This method is blocking until the thread has stopped.
      • setHeartbeatsDisabled

        public static void setHeartbeatsDisabled​(boolean heartbeatsDisabled)
        For testing purposes only to simulate loss of heartbeats.
        Parameters:
        heartbeatsDisabled - Set true to prevent heartbeats from being sent.