Package org.jgroups.protocols
Class RemoveQueueBundler
java.lang.Object
org.jgroups.protocols.BaseBundler
org.jgroups.protocols.RemoveQueueBundler
- All Implemented Interfaces:
Bundler
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 to TransferQueueBundler, this bundler uses a RingBuffer rather 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
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AverageMinMaxprotected intprotected RingBuffer<Message> protected Message[]protected Runnerprotected static final StringFields inherited from class org.jgroups.protocols.BaseBundler
avg_send_time, capacity, count, lock, log, max_size, msgs, output, transport -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintIf 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.voidCalled after creation of the bundlervoidvoidintvoidrun()voidprotected voidsendMessageList(Address dest, Address src, List<Message> list) intsize()Returns the total number of messages in the hashmapvoidstart()Called afterBundler.init(TP)voidstop()Methods inherited from class org.jgroups.protocols.BaseBundler
addMessage, getCapacity, getMaxSize, sendBundledMessages, sendSingleMessage, setCapacity, setMaxSize, viewChange
-
Field Details
-
rb
-
runner
-
remove_queue
-
avg_batch_size
-
THREAD_NAME
- See Also:
-
queue_size
protected int queue_size
-
-
Constructor Details
-
RemoveQueueBundler
public RemoveQueueBundler()
-
-
Method Details
-
avgBatchSize
-
ringBufferSize
public int ringBufferSize() -
resetStats
public void resetStats()- Specified by:
resetStatsin interfaceBundler- Overrides:
resetStatsin classBaseBundler
-
init
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
- Specified by:
sendin interfaceBundler- Overrides:
sendin classBaseBundler- Throws:
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
-
sendMessageList
- Overrides:
sendMessageListin classBaseBundler
-