Package org.jgroups.protocols
Class AlternatingBundler
- java.lang.Object
-
- org.jgroups.protocols.BaseBundler
-
- org.jgroups.protocols.TransferQueueBundler
-
- org.jgroups.protocols.AlternatingBundler
-
- All Implemented Interfaces:
java.lang.Runnable
,Bundler
,DiagnosticsHandler.ProbeHandler
public class AlternatingBundler extends TransferQueueBundler implements DiagnosticsHandler.ProbeHandler
Bundler implementation which sends message batches (or single messages) as soon as the target destination changes (or max_bundler_size would be exceeded).
Messages are removed from the main queue one by one and processed as follows:
A B B C C A causes the following sends: A -> {CC} -> {BB} -> A
Note that null is also a valid destination (send-to-all).
JIRA: https://issues.jboss.org/browse/JGRP-2171- Since:
- 4.0.4
- Author:
- Bela Ban
-
-
Field Summary
Fields Modifier and Type Field Description protected AverageMinMax
avg_batch_size
protected Address
target_dest
protected java.util.List<Message>
target_list
-
Fields inherited from class org.jgroups.protocols.TransferQueueBundler
avg_fill_count, bundler_thread, drop_when_full, num_drops_on_full_queue, num_sends_because_full_queue, num_sends_because_no_msgs, queue, remove_queue, running, THREAD_NAME
-
-
Constructor Summary
Constructors Constructor Description AlternatingBundler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_addMessage(Message msg, long size)
protected void
_sendBundledMessages()
java.util.Map<java.lang.String,java.lang.String>
handleProbe(java.lang.String... keys)
Handles a probe.void
run()
void
start()
Called afterBundler.init(TP)
void
stop()
java.lang.String[]
supportedKeys()
Returns a list of supported keys-
Methods inherited from class org.jgroups.protocols.TransferQueueBundler
addAndSendIfSizeExceeded, assertPositive, drain, getBufferSize, getDropWhenFull, getQueueSize, getStats, getThread, init, removeQueueSize, removeQueueSize, resetStats, send, setDropWhenFull, size
-
Methods inherited from class org.jgroups.protocols.BaseBundler
addMessage, clearMessages, sendBundledMessages, sendMessageList, sendSingleMessage, viewChange
-
-
-
-
Field Detail
-
target_dest
protected Address target_dest
-
target_list
protected final java.util.List<Message> target_list
-
avg_batch_size
protected final AverageMinMax avg_batch_size
-
-
Method Detail
-
start
public void start()
Description copied from interface:Bundler
Called afterBundler.init(TP)
- Specified by:
start
in interfaceBundler
- Overrides:
start
in classTransferQueueBundler
-
stop
public void stop()
- Specified by:
stop
in interfaceBundler
- Overrides:
stop
in classTransferQueueBundler
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
- Overrides:
run
in classTransferQueueBundler
-
handleProbe
public java.util.Map<java.lang.String,java.lang.String> handleProbe(java.lang.String... keys)
Description copied from interface:DiagnosticsHandler.ProbeHandler
Handles a probe. For each key that is handled, the key and its result should be in the returned map.- Specified by:
handleProbe
in interfaceDiagnosticsHandler.ProbeHandler
- Returns:
- Map
. A map of keys and values. A null return value is permissible.
-
supportedKeys
public java.lang.String[] supportedKeys()
Description copied from interface:DiagnosticsHandler.ProbeHandler
Returns a list of supported keys- Specified by:
supportedKeys
in interfaceDiagnosticsHandler.ProbeHandler
-
_sendBundledMessages
protected void _sendBundledMessages()
- Overrides:
_sendBundledMessages
in classTransferQueueBundler
-
_addMessage
protected void _addMessage(Message msg, long size)
- Overrides:
_addMessage
in classTransferQueueBundler
-
-