Located in compilation unit of org.
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.
This API is overkill for simple counters (e.g. no need for the 'mask') and is untested as an API for making a scalable r/w lock and so is likely to change!
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private volatile ConcurrentAutoTable. | |
| private static final VarHandle |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| private long | |
| private boolean | |
| public void | |
| public long | |
| public long | |
| private static final int | |
| public void | |
| public int | |
| public int | |
| public long | |
| public void | |
| public String | toString()
Overrides java. Return the counter's |
| _cat | back to summary |
|---|---|
| private volatile ConcurrentAutoTable. | |
| catHandle | back to summary |
|---|---|
| private static final VarHandle catHandle | |
| ConcurrentAutoTable | back to summary |
|---|---|
| pack-priv 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_mask | back to summary |
|---|---|
| private long add_if_mask(long x, long mask) | |
| 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 final 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 | |
| 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 final ConcurrentAutoTable. | |
| pack-priv volatile long | |
| private volatile long | |
| private long[] | |
| private static final int | |
| private static final VarHandle |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public long | |
| public void | |
| public void | |
| public void | |
| private static final boolean | |
| private static final boolean | |
| public long | |
| public long | |
| pack-priv String |
| _fuzzy_sum_cache | back to summary |
|---|---|
| private volatile long _fuzzy_sum_cache | |
| _fuzzy_time | back to summary |
|---|---|
| private volatile long _fuzzy_time | |
| _next | back to summary |
|---|---|
| private final ConcurrentAutoTable. | |
| _resizers | back to summary |
|---|---|
| pack-priv volatile long _resizers | |
| _sum_cache | back to summary |
|---|---|
| private volatile long _sum_cache | |
| _t | back to summary |
|---|---|
| private long[] _t | |
| MAX_SPIN | back to summary |
|---|---|
| private static final int MAX_SPIN | |
| resizerHandle | back to summary |
|---|---|
| private static final VarHandle resizerHandle | |
| CAT | back to summary |
|---|---|
| pack-priv CAT(ConcurrentAutoTable. | |
| add_if_mask | back to summary |
|---|---|
| public long add_if_mask(long x, long mask, int hash, ConcurrentAutoTable master) | |
| all_and | back to summary |
|---|---|
| public void all_and(long mask) | |
| all_or | back to summary |
|---|---|
| public void all_or(long mask) | |
| all_set | back to summary |
|---|---|
| public void all_set(long val) | |
| CAS | back to summary |
|---|---|
| private static final boolean CAS(long[] A, int idx, long old, long nnn) | |
| CASnoUnsafe | back to summary |
|---|---|
| private static final boolean CASnoUnsafe(long[] A, int idx, long old, long nnn) | |
| estimate_sum | back to summary |
|---|---|
| public long estimate_sum(long mask) | |
| sum | back to summary |
|---|---|
| public long sum(long mask) | |
| toString | back to summary |
|---|---|
| pack-priv String toString(long mask) | |