Class StripedCounters<T>
java.lang.Object
org.infinispan.commons.util.concurrent.StripedCounters<T>
Duplicates a set of counters in a set of stripes, so that multiple threads can increment those counters without too
much contention.
Callers must first obtain a stripe for the current thread with stripeForCurrentThread()
, then use increment(AtomicLongFieldUpdater, Object)
or add(AtomicLongFieldUpdater, Object, long)
to update one or
more counters in that stripe. They must also provide a AtomicLongFieldUpdater
to access a specific counter in
the stripe - it should be defined as static final
so that it can be inlined by the JIT.
- Since:
- 9.0
- Author:
- Dan Berindei
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(AtomicLongFieldUpdater<T> updater, T stripe, long delta) long
get
(AtomicLongFieldUpdater<T> updater) void
increment
(AtomicLongFieldUpdater<T> updater, T stripe) void
reset
(AtomicLongFieldUpdater<T> updater)
-
Constructor Details
-
StripedCounters
-
-
Method Details
-
increment
-
add
-
get
-
reset
-
stripeForCurrentThread
-