Class StripedCounters<T>
- java.lang.Object
- 
- org.infinispan.commons.util.concurrent.StripedCounters<T>
 
- 
 public final class StripedCounters<T> extends Object 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 useincrement(AtomicLongFieldUpdater, Object)oradd(AtomicLongFieldUpdater, Object, long)to update one or more counters in that stripe. They must also provide aAtomicLongFieldUpdaterto access a specific counter in the stripe - it should be defined asstatic finalso that it can be inlined by the JIT.- Since:
- 9.0
- Author:
- Dan Berindei
 
- 
- 
Constructor SummaryConstructors Constructor Description StripedCounters(Supplier<T> stripeSupplier)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(AtomicLongFieldUpdater<T> updater, T stripe, long delta)longget(AtomicLongFieldUpdater<T> updater)voidincrement(AtomicLongFieldUpdater<T> updater, T stripe)voidreset(AtomicLongFieldUpdater<T> updater)TstripeForCurrentThread()
 
- 
- 
- 
Method Detail- 
incrementpublic void increment(AtomicLongFieldUpdater<T> updater, T stripe) 
 - 
addpublic void add(AtomicLongFieldUpdater<T> updater, T stripe, long delta) 
 - 
getpublic long get(AtomicLongFieldUpdater<T> updater) 
 - 
resetpublic void reset(AtomicLongFieldUpdater<T> updater) 
 - 
stripeForCurrentThreadpublic T stripeForCurrentThread() 
 
- 
 
-