Package io.aeron
Class Counter
java.lang.Object
org.agrona.concurrent.status.AtomicCounter
io.aeron.Counter
- All Implemented Interfaces:
AutoCloseable
Counter stored in a file managed by the media driver which can be observed with AeronStat.
-
Constructor Summary
ConstructorsConstructorDescriptionCounter(CountersReader countersReader, long registrationId, int counterId) Construct a read-write view of an existing counter. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the counter, releasing the resource managed by the media driver if this was the creator of the Counter.booleanisClosed()Has this object been closed and should no longer be used?longReturn the registration id used to register this counter with the media driver.Methods inherited from class org.agrona.concurrent.status.AtomicCounter
appendToLabel, compareAndSet, decrement, decrementOpaque, decrementOrdered, decrementPlain, decrementRelease, disconnectCountersManager, get, getAcquire, getAndAdd, getAndAddOpaque, getAndAddOrdered, getAndAddPlain, getAndAddRelease, getAndSet, getOpaque, getPlain, getWeak, id, increment, incrementOpaque, incrementOrdered, incrementPlain, incrementRelease, label, proposeMax, proposeMaxOpaque, proposeMaxOrdered, proposeMaxRelease, set, setOpaque, setOrdered, setPlain, setRelease, setWeak, toString, updateKey, updateKey, updateLabel
-
Constructor Details
-
Counter
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 orAeron.NULL_VALUEif 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:
closein interfaceAutoCloseable- Overrides:
closein classAtomicCounter
-
isClosed
public boolean isClosed()Has this object been closed and should no longer be used?- Overrides:
isClosedin classAtomicCounter- Returns:
- true if it has been closed otherwise false.
-