Interface HeartbeatManager<I,​O>

  • Type Parameters:
    I - Type of the incoming payload
    O - Type of the outgoing payload
    All Superinterfaces:
    HeartbeatTarget<I>
    All Known Implementing Classes:
    NoOpHeartbeatManager

    public interface HeartbeatManager<I,​O>
    extends HeartbeatTarget<I>
    A heartbeat manager has to be able to start/stop monitoring a HeartbeatTarget, and report heartbeat timeouts for this target.
    • Method Detail

      • monitorTarget

        void monitorTarget​(ResourceID resourceID,
                           HeartbeatTarget<O> heartbeatTarget)
        Start monitoring a HeartbeatTarget. Heartbeat timeouts for this target are reported to the HeartbeatListener associated with this heartbeat manager.
        Parameters:
        resourceID - Resource ID identifying the heartbeat target
        heartbeatTarget - Interface to send heartbeat requests and responses to the heartbeat target
      • unmonitorTarget

        void unmonitorTarget​(ResourceID resourceID)
        Stops monitoring the heartbeat target with the associated resource ID.
        Parameters:
        resourceID - Resource ID of the heartbeat target which shall no longer be monitored
      • stop

        void stop()
        Stops the heartbeat manager.
      • getLastHeartbeatFrom

        long getLastHeartbeatFrom​(ResourceID resourceId)
        Returns the last received heartbeat from the given target.
        Parameters:
        resourceId - for which to return the last heartbeat
        Returns:
        Last heartbeat received from the given target or -1 if the target is not being monitored.