Package io.aeron

Class Counter

All Implemented Interfaces:
AutoCloseable

public final class Counter extends AtomicCounter
Counter stored in a file managed by the media driver which can be observed with AeronStat.
  • Constructor Details

    • Counter

      public Counter(CountersReader countersReader, long registrationId, int counterId)
      Construct a read-write view of an existing counter.
      Parameters:
      countersReader - for getting access to the buffers.
      registrationId - assigned by the driver for the counter or Aeron.NULL_VALUE if not known.
      counterId - for the counter to be viewed.
      Throws:
      AeronException - if the id has for the counter has not been allocated.
  • Method Details

    • registrationId

      public long registrationId()
      Return the registration id used to register this counter with the media driver.
      Returns:
      the registration id used to register this counter with the media driver.
    • close

      public void close()
      Close the counter, releasing the resource managed by the media driver if this was the creator of the Counter.

      This method is idempotent and thread safe.

      Specified by:
      close in interface AutoCloseable
      Overrides:
      close in class AtomicCounter
    • isClosed

      public boolean isClosed()
      Has this object been closed and should no longer be used?
      Overrides:
      isClosed in class AtomicCounter
      Returns:
      true if it has been closed otherwise false.