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 AverageMinMaxavg_batch_sizeprotected Addresstarget_destprotected 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.voidrun()voidstart()Called afterBundler.init(TP)voidstop()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:BundlerCalled afterBundler.init(TP)- Specified by:
startin interfaceBundler- Overrides:
startin classTransferQueueBundler
-
stop
public void stop()
- Specified by:
stopin interfaceBundler- Overrides:
stopin classTransferQueueBundler
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable- Overrides:
runin classTransferQueueBundler
-
handleProbe
public java.util.Map<java.lang.String,java.lang.String> handleProbe(java.lang.String... keys)
Description copied from interface:DiagnosticsHandler.ProbeHandlerHandles a probe. For each key that is handled, the key and its result should be in the returned map.- Specified by:
handleProbein 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.ProbeHandlerReturns a list of supported keys- Specified by:
supportedKeysin interfaceDiagnosticsHandler.ProbeHandler
-
_sendBundledMessages
protected void _sendBundledMessages()
- Overrides:
_sendBundledMessagesin classTransferQueueBundler
-
_addMessage
protected void _addMessage(Message msg, long size)
- Overrides:
_addMessagein classTransferQueueBundler
-
-