public class ManyToOneRingBuffer extends java.lang.Object implements RingBuffer
| Modifier and Type | Field and Description |
|---|---|
static int |
PADDING_MSG_TYPE_ID
Record type is padding to prevent fragmentation in the buffer.
|
| Constructor and Description |
|---|
ManyToOneRingBuffer(AtomicBuffer buffer)
Construct a new
RingBuffer based on an underlying AtomicBuffer. |
| Modifier and Type | Method and Description |
|---|---|
AtomicBuffer |
buffer()
Get the underlying buffer used by the RingBuffer for storage.
|
int |
capacity()
Get the capacity of the ring-buffer in bytes for exchange.
|
long |
consumerHeartbeatTime()
The time of the last consumer heartbeat.
|
void |
consumerHeartbeatTime(long time)
Set the time of the last consumer heartbeat.
|
long |
consumerPosition()
The position in bytes from start up for the consumers.
|
int |
maxMsgLength()
The maximum message length in bytes supported by the underlying ring buffer.
|
long |
nextCorrelationId()
Get the next value that can be used for a correlation id on an message when a response needs to be correlated.
|
long |
producerPosition()
The position in bytes from start up of the producers.
|
int |
read(MessageHandler handler)
Read as many messages as are available from the ring buffer.
|
int |
read(MessageHandler handler,
int messageCountLimit)
Read as many messages as are available from the ring buffer to up a supplied maximum.
|
int |
size()
Size of the backlog of bytes in the buffer between producers and consumers.
|
boolean |
unblock()
Unblock a multi-producer ring buffer where a producer has died during the act of offering.
|
boolean |
write(int msgTypeId,
DirectBuffer srcBuffer,
int srcIndex,
int length)
Non-blocking write of an message to an underlying ring-buffer.
|
public static final int PADDING_MSG_TYPE_ID
public ManyToOneRingBuffer(AtomicBuffer buffer)
RingBuffer based on an underlying AtomicBuffer.
The underlying buffer must a power of 2 in size plus sufficient space
for the RingBufferDescriptor.TRAILER_LENGTH.buffer - via which events will be exchanged.java.lang.IllegalStateException - if the buffer capacity is not a power of 2
plus RingBufferDescriptor.TRAILER_LENGTH in capacity.public int capacity()
capacity in interface RingBufferpublic boolean write(int msgTypeId,
DirectBuffer srcBuffer,
int srcIndex,
int length)
write in interface RingBuffermsgTypeId - type of the message encoding.srcBuffer - containing the encoded binary message.srcIndex - at which the encoded message begins.length - of the encoded message in bytes.public int read(MessageHandler handler)
read in interface RingBufferhandler - to be called for processing each message in turn.public int read(MessageHandler handler, int messageCountLimit)
read in interface RingBufferhandler - to be called for processing each message in turn.messageCountLimit - the number of messages will be read in a single invocation.public int maxMsgLength()
maxMsgLength in interface RingBufferpublic long nextCorrelationId()
nextCorrelationId in interface RingBufferpublic AtomicBuffer buffer()
buffer in interface RingBufferpublic void consumerHeartbeatTime(long time)
System.nanoTime()
is not a valid option.consumerHeartbeatTime in interface RingBuffertime - of the last consumer heartbeat.public long consumerHeartbeatTime()
consumerHeartbeatTime in interface RingBufferpublic long producerPosition()
producerPosition in interface RingBufferpublic long consumerPosition()
consumerPosition in interface RingBufferpublic int size()
size in interface RingBufferpublic boolean unblock()
unblock in interface RingBufferCopyright © 2014 - 2016 Real Logic Ltd. All Rights Reserved.