Java Code Examples for org.agrona.concurrent.UnsafeBuffer#putIntOrdered()

The following examples show how to use org.agrona.concurrent.UnsafeBuffer#putIntOrdered() . 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: FrameDescriptor.java    From aeron with Apache License 2.0 5 votes vote down vote up
/**
 * Write the length header for a frame in a memory ordered fashion.
 *
 * @param buffer      containing the frame.
 * @param termOffset  at which a frame begins.
 * @param frameLength field to be set for the frame.
 */
public static void frameLengthOrdered(final UnsafeBuffer buffer, final int termOffset, final int frameLength)
{
    int length = frameLength;
    if (ByteOrder.nativeOrder() != LITTLE_ENDIAN)
    {
        length = Integer.reverseBytes(frameLength);
    }

    buffer.putIntOrdered(termOffset, length);
}
 
Example 2
Source File: LogBufferDescriptor.java    From aeron with Apache License 2.0 2 votes vote down vote up
/**
 * Set the number of active transports for the Image.
 *
 * @param metadataBuffer containing the meta data.
 * @param numberOfActiveTransports value to be set.
 */
public static void activeTransportCount(final UnsafeBuffer metadataBuffer, final int numberOfActiveTransports)
{
    metadataBuffer.putIntOrdered(LOG_ACTIVE_TRANSPORT_COUNT, numberOfActiveTransports);
}
 
Example 3
Source File: LogBufferDescriptor.java    From aeron with Apache License 2.0 2 votes vote down vote up
/**
 * Set the value of the current active term count for the producer using memory ordered semantics.
 *
 * @param metadataBuffer containing the meta data.
 * @param termCount      value of the active term count used by the producer of this log.
 */
public static void activeTermCountOrdered(final UnsafeBuffer metadataBuffer, final int termCount)
{
    metadataBuffer.putIntOrdered(LOG_ACTIVE_TERM_COUNT_OFFSET, termCount);
}