public class PaddedAtomicLong extends AtomicLong
AtomicLong to prevent the FalseSharing problem
The CPU cache line commonly be 64 bytes, here is a sample of cache line after padding:
64 bytes = 8 bytes (object reference) + 6 * 8 bytes (padded long) + 8 bytes (a long value)
| 构造器和说明 |
|---|
PaddedAtomicLong()
Constructors from
AtomicLong |
PaddedAtomicLong(long initialValue) |
| 限定符和类型 | 方法和说明 |
|---|---|
long |
sumPaddingToPreventOptimization()
To prevent GC optimizations for cleaning unused padded references
|
accumulateAndGet, addAndGet, compareAndSet, decrementAndGet, doubleValue, floatValue, get, getAndAccumulate, getAndAdd, getAndDecrement, getAndIncrement, getAndSet, getAndUpdate, incrementAndGet, intValue, lazySet, longValue, set, toString, updateAndGet, weakCompareAndSetbyteValue, shortValuepublic PaddedAtomicLong()
AtomicLongpublic PaddedAtomicLong(long initialValue)
Copyright © 2023. All rights reserved.