Class HeartbeatPublisher

  • All Implemented Interfaces:
    Runnable

    public final class HeartbeatPublisher
    extends Object
    implements Runnable
    Publishes a HeartbeatMsg on a given protocol session if no message has been published since the last heartbeat interval period.

    These heartbeat messages are sent to a peer replica or to a peer RS.

    • Constructor Detail

      • HeartbeatPublisher

        public HeartbeatPublisher​(String name,
                                  Session session,
                                  long heartbeatInterval)
        Create a heartbeat publisher.
        Parameters:
        name - The name of the heartbeat.
        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
      • 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.