Package org.jgroups.protocols
Class TransferQueueBundler2
java.lang.Object
org.jgroups.protocols.TransferQueueBundler2
This bundler adds all (unicast or multicast) messages to a queue until max size has been exceeded, but does send
messages immediately when no other messages are available. https://issues.redhat.com/browse/JGRP-1540
The difference to TransferQueueBundler is that a size is maintained
per destinationand we maintain byte arrays of max_bundle_size per destination into which we marshall a message directly when it is sent.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AverageMinMaxprotected Threadprotected intprotected Logprotected intMaximum number of bytes for messages to be queued until they are sent.protected final Map<Address, TransferQueueBundler2.Buffer> protected static final NullAddressprotected longprotected longprotected longprotected BlockingQueue<Message> protected booleanprotected static final Stringprotected TP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected static intassertPositive(int value, String message) protected voiddrain()Takes all messages from the queue, adds them to the hashmap and then sends all bundled messagesdump()intIf the bundler implementation supports a capacity (e.g.intMaximum number of bytes for messages to be queued until they are sentintIf 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.protected booleanvoidCalled after creation of the bundlerintremoveQueueSize(int size) voidvoidvoidrun()voidprotected voidsetCapacity(int c) setMaxSize(int s) intsize()The number of unsent messages in the bundlervoidstart()Called afterBundler.init(TP)voidstop()voidviewChange(View view)
-
Field Details
-
max_size
protected int max_sizeMaximum number of bytes for messages to be queued until they are sent. This value needs to be smaller than the largest datagram packet size in case of UDP -
capacity
protected int capacity -
poll_timeout
protected long poll_timeout -
transport
-
log
-
queue
-
remove_queue
-
bundler_thread
-
running
protected volatile boolean running -
num_sends_because_full_queue
protected long num_sends_because_full_queue -
num_sends_because_no_msgs
protected long num_sends_because_no_msgs -
avg_fill_count
-
THREAD_NAME
- See Also:
-
messages
-
NIL
-
-
Constructor Details
-
TransferQueueBundler2
public TransferQueueBundler2() -
TransferQueueBundler2
-
TransferQueueBundler2
public TransferQueueBundler2(int capacity)
-
-
Method Details
-
getCapacity
public int getCapacity()Description copied from interface:BundlerIf the bundler implementation supports a capacity (e.g.RingBufferBundler, then return it, else return -1- Specified by:
getCapacityin interfaceBundler
-
setCapacity
-
getMaxSize
public int getMaxSize()Description copied from interface:BundlerMaximum number of bytes for messages to be queued until they are sent- Specified by:
getMaxSizein interfaceBundler
-
setMaxSize
- Specified by:
setMaxSizein interfaceBundler
-
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
-
removeQueueSize
public int removeQueueSize() -
removeQueueSize
-
dump
-
init
Description copied from interface:BundlerCalled after creation of the bundler -
resetStats
public void resetStats()- Specified by:
resetStatsin interfaceBundler
-
viewChange
- Specified by:
viewChangein interfaceBundler
-
start
public void start()Description copied from interface:BundlerCalled afterBundler.init(TP) -
stop
public void stop() -
renameThread
public void renameThread()- Specified by:
renameThreadin interfaceBundler
-
size
public int size()Description copied from interface:BundlerThe number of unsent messages in the bundler -
send
-
run
public void run() -
hasMessages
protected boolean hasMessages() -
addAndSendIfSizeExceeded
-
sendBundledMessages
protected void sendBundledMessages() -
drain
protected void drain()Takes all messages from the queue, adds them to the hashmap and then sends all bundled messages -
assertPositive
-