Conor Fennell
04/26/2021, 9:36 PMio.prometheus.client.Counter
The prometheus Counter is a Java library.
Is there any concurrency issues people would foresee?
The prometheus implementation uses Compare and Swap operations so should be coroutine safe.
But saying that, there is a thread hash code used for some accounting ThreadLocal()
.
static final ThreadLocal<int[]> threadHashCode = new ThreadLocal();
static final Random rng = new Random();
static final int NCPU = Runtime.getRuntime().availableProcessors();
transient volatile Striped64.Cell[] cells;
transient volatile long base;
transient volatile int busy;
private static final AtomicLongFieldUpdater<Striped64> CAS_BASE = AtomicLongFieldUpdater.newUpdater(Striped64.class, "base");
private static final AtomicIntegerFieldUpdater<Striped64> CAS_BUSY = AtomicIntegerFieldUpdater.newUpdater(Striped64.class, "busy");
TwoClocks
04/27/2021, 3:55 AMuli
04/27/2021, 11:53 AMTwoClocks
04/27/2021, 3:04 PM