Package org.agrona.concurrent.broadcast
Class CopyBroadcastReceiver
java.lang.Object
org.agrona.concurrent.broadcast.CopyBroadcastReceiver
Receiver that copies messages which have been broadcast to enable a simpler API for the client.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault length for the scratch buffer for copying messages into. -
Constructor Summary
ConstructorsConstructorDescriptionCopyBroadcastReceiver(BroadcastReceiver receiver) Wrap aBroadcastReceiverto simplify the API for receiving messages.CopyBroadcastReceiver(BroadcastReceiver receiver, int scratchBufferLength) Wrap aBroadcastReceiverto simplify the API for receiving messages.CopyBroadcastReceiver(BroadcastReceiver receiver, MutableDirectBuffer scratchBuffer) Wrap aBroadcastReceiverto simplify the API for receiving messages. -
Method Summary
Modifier and TypeMethodDescriptionGet the underlyingBroadcastReceiverwhich this is wrapping and copying out of.intreceive(MessageHandler handler) Receive one message from the broadcast buffer.
-
Field Details
-
SCRATCH_BUFFER_LENGTH
public static final int SCRATCH_BUFFER_LENGTHDefault length for the scratch buffer for copying messages into.- See Also:
-
-
Constructor Details
-
CopyBroadcastReceiver
Wrap aBroadcastReceiverto simplify the API for receiving messages.- Parameters:
receiver- to be wrapped.scratchBuffer- to be used for copying receive buffers.
-
CopyBroadcastReceiver
Wrap aBroadcastReceiverto simplify the API for receiving messages.- Parameters:
receiver- to be wrapped.scratchBufferLength- is the maximum length of a message to be copied when receiving.
-
CopyBroadcastReceiver
Wrap aBroadcastReceiverto simplify the API for receiving messages.- Parameters:
receiver- to be wrapped.
-
-
Method Details
-
broadcastReceiver
Get the underlyingBroadcastReceiverwhich this is wrapping and copying out of.- Returns:
- the underlying
BroadcastReceiverwhich this is wrapping and copying out of.
-
receive
Receive one message from the broadcast buffer.- Parameters:
handler- to be called for each message received.- Returns:
- the number of messages that have been received.
-