| 27 | import io.questdb.std.Unsafe; |
| 28 | |
| 29 | public abstract class AbstractSequence extends RhsPadding { |
| 30 | private static final long CACHE_OFFSET = Unsafe.getFieldOffset(Value.class, "cache"); |
| 31 | private static final long VALUE_OFFSET = Unsafe.getFieldOffset(Value.class, "value"); |
| 32 | |
| 33 | public AbstractSequence(WaitStrategy waitStrategy) { |
| 34 | super(waitStrategy); |
| 35 | } |
| 36 | |
| 37 | protected boolean casValue(long expected, long value) { |
| 38 | return Unsafe.cas(this, VALUE_OFFSET, expected, value); |
| 39 | } |
| 40 | |
| 41 | protected long getValue() { |
| 42 | return Unsafe.getLong(this, VALUE_OFFSET); |
| 43 | } |
| 44 | |
| 45 | protected void setCacheFenced(long cache) { |
| 46 | Unsafe.putOrderedLong(this, CACHE_OFFSET, cache); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | @SuppressWarnings("unused") |
| 51 | class LhsPadding { |
nothing calls this directly
no test coverage detected
searching dependent graphs…