Java Code Examples for org.agrona.concurrent.AtomicBuffer#putLongVolatile()

The following examples show how to use org.agrona.concurrent.AtomicBuffer#putLongVolatile() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BufferAlignmentAgentTest.java    From agrona with Apache License 2.0 6 votes vote down vote up
private void testAlignedAtomicMethods(final AtomicBuffer buffer, final int offset)
{
    buffer.getLongVolatile(offset + SIZE_OF_LONG);
    buffer.putLongVolatile(offset + SIZE_OF_LONG, Long.MAX_VALUE);
    buffer.compareAndSetLong(offset + SIZE_OF_LONG, Long.MAX_VALUE, Long.MAX_VALUE);
    buffer.getAndAddLong(offset + SIZE_OF_LONG, Long.MAX_VALUE);
    buffer.getAndSetLong(offset + SIZE_OF_LONG, Long.MAX_VALUE);
    buffer.putLongOrdered(offset + SIZE_OF_LONG, Long.MAX_VALUE);
    buffer.addLongOrdered(offset + SIZE_OF_LONG, Long.MAX_VALUE);

    buffer.getIntVolatile(offset + SIZE_OF_INT);
    buffer.putIntVolatile(offset + SIZE_OF_INT, Integer.MAX_VALUE);
    buffer.compareAndSetInt(offset + SIZE_OF_INT, Integer.MAX_VALUE, Integer.MAX_VALUE);
    buffer.getAndAddInt(offset + SIZE_OF_INT, Integer.MAX_VALUE);
    buffer.getAndSetInt(offset + SIZE_OF_INT, Integer.MAX_VALUE);
    buffer.putIntOrdered(offset + SIZE_OF_INT, Integer.MAX_VALUE);
    buffer.addIntOrdered(offset + SIZE_OF_INT, Integer.MAX_VALUE);

    buffer.getShortVolatile(offset + SIZE_OF_SHORT);
    buffer.putShortVolatile(offset + SIZE_OF_SHORT, Short.MAX_VALUE);
    buffer.getCharVolatile(offset + SIZE_OF_CHAR);
    buffer.putCharVolatile(offset + SIZE_OF_CHAR, Character.MAX_VALUE);
    buffer.getByteVolatile(offset + SIZE_OF_BYTE);
    buffer.putByteVolatile(offset + SIZE_OF_BYTE, Byte.MAX_VALUE);
}
 
Example 2
Source File: IndexedPositionWriter.java    From artio with Apache License 2.0 4 votes vote down vote up
private void putPosition(final long position, final AtomicBuffer buffer, final int offset)
{
    buffer.putLongVolatile(offset + POSITION_OFFSET, position);
}