Class HeartbeatTimestamp

java.lang.Object
io.aeron.status.HeartbeatTimestamp
Direct Known Subclasses:
ClientHeartbeatTimestamp

public class HeartbeatTimestamp extends Object
Allocate a counter for tracking the last heartbeat of an entity with a given registration id.
  • Field Details

    • HEARTBEAT_TYPE_ID

      public static final int HEARTBEAT_TYPE_ID
      Type id of a heartbeat counter.
      See Also:
    • REGISTRATION_ID_OFFSET

      public static final int REGISTRATION_ID_OFFSET
      Offset in the key metadata for the registration id of the counter.
      See Also:
  • Constructor Details

    • HeartbeatTimestamp

      public HeartbeatTimestamp()
  • Method Details

    • allocate

      public static AtomicCounter allocate(MutableDirectBuffer tempBuffer, String name, int typeId, CountersManager countersManager, long registrationId)
      Allocate a counter for tracking the last heartbeat of an entity.
      Parameters:
      tempBuffer - to be used for labels and key.
      name - of the counter for the label.
      typeId - of the counter for classification.
      countersManager - from which the underlying storage is allocated.
      registrationId - to be associated with the counter.
      Returns:
      a new AtomicCounter for tracking the last heartbeat.
    • allocateCounterId

      public static int allocateCounterId(MutableDirectBuffer tempBuffer, String name, int typeId, CountersManager countersManager, long registrationId)
      Allocate a counter id for tracking the last heartbeat of an entity.
      Parameters:
      tempBuffer - to be used for labels and key.
      name - of the counter for the label.
      typeId - of the counter for classification.
      countersManager - from which the underlying storage is allocated.
      registrationId - to be associated with the counter.
      Returns:
      the counter id to be used.
    • findCounterIdByRegistrationId

      public static int findCounterIdByRegistrationId(CountersReader countersReader, int counterTypeId, long registrationId)
      Find the active counter id for a heartbeat timestamp.
      Parameters:
      countersReader - to search within.
      counterTypeId - to match on.
      registrationId - for the active client.
      Returns:
      the counter id if found otherwise CountersReader.NULL_COUNTER_ID.
    • isActive

      public static boolean isActive(CountersReader countersReader, int counterId, int counterTypeId, long registrationId)
      Is the counter active for usage? Checks to see if reclaimed or reused and matches registration id.
      Parameters:
      countersReader - to search within.
      counterId - to test.
      counterTypeId - to validate type.
      registrationId - for the entity.
      Returns:
      true if still valid otherwise false.