Package org.jgroups.protocols
Class RemoveQueueBundler
- java.lang.Object
-
- org.jgroups.protocols.BaseBundler
-
- org.jgroups.protocols.RemoveQueueBundler
-
- All Implemented Interfaces:
Bundler
public class RemoveQueueBundler extends BaseBundler
Bundler implementation which sends message batches (or single messages) as soon as the remove queue is full (or max_bundler_size would be exceeded).
Messages are removed from the main queue and processed as follows (assuming they all fit into the remove queue):
A B B C C A causes the following sends: {AA} -> {CC} -> {BB}
Note that null is also a valid destination (send-to-all).
Contrary toTransferQueueBundler, this bundler uses aRingBufferrather than an ArrayBlockingQueue and the size of the remove queue is fixed. TransferQueueBundler increases the size of the remove queue dynamically, which leads to higher latency if the remove queue grows too much.
JIRA: https://issues.redhat.com/browse/JGRP-2171- Since:
- 4.0.4
- Author:
- Bela Ban
-
-
Field Summary
Fields Modifier and Type Field Description protected intqueue_sizeprotected RingBuffer<Message>rbprotected Message[]remove_queueprotected Runnerrunnerprotected static java.lang.StringTHREAD_NAME-
Fields inherited from class org.jgroups.protocols.BaseBundler
avg_fill_count, avg_remove_queue_size, avg_send_time, capacity, count, drop_when_full, FMT, FUNC, lock, log, max_size, msg_processing_policy, msg_stats, msgs, num_batches_sent, num_drops_on_full_queue, num_sends_because_full_queue, num_sends_because_no_msgs, num_single_msgs_sent, output, remove_queue_capacity, suppress_log, suppress_log_timeout, total_msgs_sent, transport, use_ringbuffer, use_single_sender_thread
-
-
Constructor Summary
Constructors Constructor Description RemoveQueueBundler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetQueueSize()If the bundler has a queue and it should be managed by a queuing discipline (like Random Early Detection), then return the number of elements in the queue, else -1.voidinit(TP transport)Called after creation of the bundlervoidrenameThread()intringBufferSize()voidrun()voidsend(Message msg)intsize()Returns the total number of messages in the hashmapvoidstart()Called afterBundler.init(TP)voidstop()-
Methods inherited from class org.jgroups.protocols.BaseBundler
addMessage, avgBatchSize, dropWhenFull, dropWhenFull, getCapacity, getMaxSize, loopback, loopback, loopbackUnlessDontLoopbackIsSet, printBuffers, removeQueueCapacity, removeQueueCapacity, resetStats, sendBundledMessages, sendMessageList, sendMessageListArray, sendMultiple, sendMultiple, sendSingle, sendSingleMessage, setCapacity, setMaxSize, useRingBuffer, useRingBuffer, useSingleSenderThread, useSingleSenderThread, viewChange
-
-
-
-
Field Detail
-
rb
protected RingBuffer<Message> rb
-
runner
protected Runner runner
-
remove_queue
protected Message[] remove_queue
-
THREAD_NAME
protected static final java.lang.String THREAD_NAME
- See Also:
- Constant Field Values
-
queue_size
protected int queue_size
-
-
Method Detail
-
ringBufferSize
public int ringBufferSize()
-
init
public void init(TP transport)
Description copied from interface:BundlerCalled after creation of the bundler- Specified by:
initin interfaceBundler- Overrides:
initin classBaseBundler- Parameters:
transport- the transport, for further reference
-
start
public void start()
Description copied from interface:BundlerCalled afterBundler.init(TP)- Specified by:
startin interfaceBundler- Overrides:
startin classBaseBundler
-
stop
public void stop()
- Specified by:
stopin interfaceBundler- Overrides:
stopin classBaseBundler
-
renameThread
public void renameThread()
-
send
public void send(Message msg) throws java.lang.Exception
- Specified by:
sendin interfaceBundler- Overrides:
sendin classBaseBundler- Throws:
java.lang.Exception
-
run
public void run()
-
getQueueSize
public int getQueueSize()
Description copied from interface:BundlerIf the bundler has a queue and it should be managed by a queuing discipline (like Random Early Detection), then return the number of elements in the queue, else -1. In the latter case, the queue won't be managed.
This method needs to be fast as it might get called on every message to be sent.- Specified by:
getQueueSizein interfaceBundler- Overrides:
getQueueSizein classBaseBundler
-
size
public int size()
Description copied from class:BaseBundlerReturns the total number of messages in the hashmap- Specified by:
sizein interfaceBundler- Overrides:
sizein classBaseBundler
-
-