Package org.jgroups.protocols
Class TransferQueueBundler
java.lang.Object
org.jgroups.protocols.BaseBundler
org.jgroups.protocols.TransferQueueBundler
- Direct Known Subclasses:
AlternatingBundler,SimplifiedTransferQueueBundler
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
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AverageMinMaxprotected Threadprotected booleanprotected longprotected longprotected longprotected BlockingQueue<Message> protected booleanprotected 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 TypeMethodDescriptionprotected voidprotected voiddrain()Takes all messages from the queue, adds them to the hashmap and then sends all bundled messagesboolean<T extends Bundler>
TdropWhenFull(boolean d) intIf 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 bundlerintvoidvoidvoidrun()voidintsize()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, sendMessageList, sendSingleMessage, setCapacity, setMaxSize, viewChange
-
Field Details
-
queue
-
remove_queue
-
bundler_thread
-
drop_when_full
protected boolean drop_when_full -
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 -
num_drops_on_full_queue
protected long num_drops_on_full_queue -
avg_fill_count
-
THREAD_NAME
- See Also:
-
-
Constructor Details
-
TransferQueueBundler
public TransferQueueBundler()
-
-
Method Details
-
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
-
removeQueueSize
public int removeQueueSize() -
dropWhenFull
public boolean dropWhenFull() -
dropWhenFull
-
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:
tp- 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()- Specified by:
renameThreadin interfaceBundler
-
size
public int size()Description copied from class:BaseBundlerReturns the total number of messages in the hashmap- Specified by:
sizein interfaceBundler- Overrides:
sizein classBaseBundler
-
send
- Specified by:
sendin interfaceBundler- Overrides:
sendin classBaseBundler- Throws:
Exception
-
run
public void run() -
addAndSendIfSizeExceeded
-
drain
protected void drain()Takes all messages from the queue, adds them to the hashmap and then sends all bundled messages
-