longs
, supporting low-contention CAS
operations. Updates are done with CAS's to no particular table element.
The intent is to support highly scalable counters, r/w locks, and other
structures where the updates are associative, loss-free (no-brainer), and
otherwise happen at such a high volume that the cache contention for
CAS'ing a single word is unacceptable.
Modifier and Type | Class and Description |
---|---|
private static class |
Modifier and Type | Field and Description |
---|---|
private volatile ConcurrentAutoTable. | |
private static AtomicReferenceFieldUpdater |
Access | Constructor and Description |
---|---|
public |
Modifier and Type | Method and Description |
---|---|
public void | |
private long | |
private boolean | |
public void | |
public long | |
public long | |
private static int | |
public void | |
public int | |
public int | |
public long | |
public void | |
public void | |
public String | toString()
Overrides java. long value converted to a string.
|
_cat | back to summary |
---|---|
private volatile ConcurrentAutoTable. |
_catUpdater | back to summary |
---|---|
private static AtomicReferenceFieldUpdater<ConcurrentAutoTable, ConcurrentAutoTable. |
ConcurrentAutoTable | back to summary |
---|---|
public ConcurrentAutoTable() |
add | back to summary |
---|---|
public void add(long x) Add the given value to current counter value. Concurrent updates will
not be lost, but addAndGet or getAndAdd are not implemented because the
total counter value (i.e., |
add_if | back to summary |
---|---|
private long add_if(long x) |
CAS_cat | back to summary |
---|---|
private boolean CAS_cat(ConcurrentAutoTable. |
decrement | back to summary |
---|---|
public void decrement()
|
estimate_get | back to summary |
---|---|
public long estimate_get() A cheaper |
get | back to summary |
---|---|
public long get() Current value of the counter. Since other threads are updating furiously the value is only approximate, but it includes all counts made by the current thread. Requires a pass over the internally striped counters. |
hash | back to summary |
---|---|
private static int hash() |
increment | back to summary |
---|---|
public void increment()
|
internal_size | back to summary |
---|---|
public int internal_size() Return the internal counter striping factor. Useful for diagnosing performance problems. |
intValue | back to summary |
---|---|
public int intValue() Same as |
longValue | back to summary |
---|---|
public long longValue() Same as |
back to summary | |
---|---|
public void print() A more verbose print than |
set | back to summary |
---|---|
public void set(long x) Atomically set the sum of the striped counters to specified value. Rather more expensive than a simple store, in order to remain atomic. |
toString | back to summary |
---|---|
public String toString() Overrides java. Return the counter's
|
Modifier and Type | Field and Description |
---|---|
private volatile long | |
private volatile long | |
private static final int | |
private static final int | |
private final ConcurrentAutoTable. | |
private final long[] | |
private static final int |
Access | Constructor and Description |
---|---|
pack-priv |
Modifier and Type | Method and Description |
---|---|
public long | |
private static boolean | |
public long | |
public void | |
private static long | |
public long | |
public String |
_fuzzy_sum_cache | back to summary |
---|---|
private volatile long _fuzzy_sum_cache |
_fuzzy_time | back to summary |
---|---|
private volatile long _fuzzy_time |
_Lbase | back to summary |
---|---|
private static final int _Lbase |
_Lscale | back to summary |
---|---|
private static final int _Lscale |
_next | back to summary |
---|---|
private final ConcurrentAutoTable. |
_t | back to summary |
---|---|
private final long[] _t |
MAX_SPIN | back to summary |
---|---|
private static final int MAX_SPIN |
CAT | back to summary |
---|---|
pack-priv CAT(ConcurrentAutoTable. |
add_if | back to summary |
---|---|
public long add_if(long x, int hash, ConcurrentAutoTable master) |
CAS | back to summary |
---|---|
private static boolean CAS(long[] A, int idx, long old, long nnn) |
estimate_sum | back to summary |
---|---|
public long estimate_sum() |
back to summary | |
---|---|
public void print() |
rawIndex | back to summary |
---|---|
private static long rawIndex(long[] ary, int i) |
sum | back to summary |
---|---|
public long sum() |
toString | back to summary |
---|---|
public String toString() Overrides java. Doc from java. Returns a string representation of the object.
|