This class may be removed in the future. Consider the replacements in JEP 193 'Variable Handles': http://openjdk.java.net/jeps/193
/** * Orders stores before the fence, with loads and stores after the fence. */ public static void storeFence() { unsafe.storeFence(); }
private void signalTailIntent(final AtomicBuffer buffer, final long newTail) { buffer.putLongOrdered(tailIntentCountIndex, newTail); UnsafeAccess.UNSAFE.storeFence(); }
/** * {@inheritDoc} */ public boolean write(final int msgTypeId, final DirectBuffer srcBuffer, final int srcIndex, final int length) { checkTypeId(msgTypeId); checkMsgLength(length); boolean isSuccessful = false; final AtomicBuffer buffer = this.buffer; final int recordLength = length + HEADER_LENGTH; final int requiredCapacity = align(recordLength, ALIGNMENT); final int recordIndex = claimCapacity(buffer, requiredCapacity); if (INSUFFICIENT_CAPACITY != recordIndex) { buffer.putIntOrdered(lengthOffset(recordIndex), -recordLength); UnsafeAccess.UNSAFE.storeFence(); buffer.putInt(typeOffset(recordIndex), msgTypeId); buffer.putBytes(encodedMsgOffset(recordIndex), srcBuffer, srcIndex, length); buffer.putIntOrdered(lengthOffset(recordIndex), recordLength); isSuccessful = true; } return isSuccessful; }
UnsafeAccess.UNSAFE.storeFence();
private void signalTailIntent(final AtomicBuffer buffer, final long newTail) { buffer.putLongOrdered(tailIntentCountIndex, newTail); UnsafeAccess.UNSAFE.storeFence(); }
@Override @ForceInline public void storeFence() { UNSAFE.storeFence(); }
@Override @ForceInline public void storeFence() { UNSAFE.storeFence(); }
private void signalTailIntent(final AtomicBuffer buffer, final long newTail) { buffer.putLong(tailIntentCountIndex, newTail); UnsafeAccess.UNSAFE.storeFence(); }
private void signalTailIntent(final AtomicBuffer buffer, final long newTail) { buffer.putLong(tailIntentCountIndex, newTail); UnsafeAccess.UNSAFE.storeFence(); }
@Override public void writeVolatileLong(@NotNull Object object, long offset, long i64) { if ((offset & 0x7) == 0) { super.writeVolatileLong(object, offset, i64); } else { writeLong(object, offset, i64); UNSAFE.storeFence(); } }
@Override public void writeVolatileLong(@NotNull Object object, long offset, long i64) { if ((offset & 0x7) == 0) { super.writeVolatileLong(object, offset, i64); } else { writeLong(object, offset, i64); UNSAFE.storeFence(); } }
@Override public void writeVolatileInt(long address, int i32) { if ((address & 0x3) == 0) { super.writeVolatileInt(address, i32); } else { writeInt(address, i32); UNSAFE.storeFence(); } }
@Override public void writeVolatileShort(long address, short i16) { if ((address & 0x1) == 0) { super.writeVolatileShort(address, i16); } else { super.writeShort(address, i16); UNSAFE.storeFence(); } }
@Override public void writeVolatileInt(long address, int i32) { if ((address & 0x3) == 0) { super.writeVolatileInt(address, i32); } else { writeInt(address, i32); UNSAFE.storeFence(); } }
@Override public void writeVolatileShort(long address, short i16) { if ((address & 0x1) == 0) { super.writeVolatileShort(address, i16); } else { super.writeShort(address, i16); UNSAFE.storeFence(); } }
@Override public void writeVolatileLong(long address, long i64) { if ((address & 0x7) == 0) { super.writeVolatileLong(address, i64); } else { writeLong(address, i64); UNSAFE.storeFence(); } }
@Override public void writeVolatileLong(long address, long i64) { if ((address & 0x7) == 0) { super.writeVolatileLong(address, i64); } else { writeLong(address, i64); UNSAFE.storeFence(); } }
private void updateKeyCount(int key) { keyCount = key + 1; // also write key count to header of key memory long seq = keyMem.getLong(BitmapIndexUtils.KEY_RESERVED_OFFSET_SEQUENCE) + 1; keyMem.putLong(BitmapIndexUtils.KEY_RESERVED_OFFSET_SEQUENCE, seq); Unsafe.getUnsafe().storeFence(); keyMem.putInt(BitmapIndexUtils.KEY_RESERVED_OFFSET_KEY_COUNT, keyCount); Unsafe.getUnsafe().storeFence(); keyMem.putLong(BitmapIndexUtils.KEY_RESERVED_OFFSET_SEQUENCE_CHECK, seq); }
private void updateValueMemSize() { long seq = keyMem.getLong(BitmapIndexUtils.KEY_RESERVED_OFFSET_SEQUENCE) + 1; keyMem.putLong(BitmapIndexUtils.KEY_RESERVED_OFFSET_SEQUENCE, seq); Unsafe.getUnsafe().storeFence(); keyMem.putLong(BitmapIndexUtils.KEY_RESERVED_OFFSET_VALUE_MEM_SIZE, valueMemSize); Unsafe.getUnsafe().storeFence(); keyMem.putLong(BitmapIndexUtils.KEY_RESERVED_OFFSET_SEQUENCE_CHECK, seq); }
private void appendValue(long offset, long valueBlockOffset, long valueCount, int valueCellIndex, long value) { // first set value valueMem.putLong(valueBlockOffset + valueCellIndex * 8L, value); Unsafe.getUnsafe().storeFence(); // update count and last value block offset for the key // in atomic fashion keyMem.putLong(offset, valueCount + 1); // write count check keyMem.putLong(offset + KEY_ENTRY_OFFSET_COUNT_CHECK, valueCount + 1); }