Package org.jgroups.protocols
Class TransferQueueBundler
- java.lang.Object
-
- org.jgroups.protocols.BaseBundler
-
- org.jgroups.protocols.TransferQueueBundler
-
- All Implemented Interfaces:
java.lang.Runnable,Bundler
- Direct Known Subclasses:
AlternatingBundler
public class TransferQueueBundler extends BaseBundler implements java.lang.Runnable
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
Fields Modifier and Type Field Description protected java.lang.Threadbundler_threadprotected java.util.concurrent.BlockingQueue<Message>queueprotected java.util.List<Message>remove_queueprotected booleanrunningprotected 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 TransferQueueBundler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddAndSendIfSizeExceeded(Message msg)protected voiddrain()Takes all messages from the queue, adds them to the hashmap and then sends all bundled messagesintgetQueueSize()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 bundlerintremoveQueueCapacity()intremoveQueueSize()voidrenameThread()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, resetStats, sendBundledMessages, sendMessageList, sendMessageListArray, sendMultiple, sendMultiple, sendSingle, sendSingleMessage, setCapacity, setMaxSize, useRingBuffer, useRingBuffer, useSingleSenderThread, useSingleSenderThread, viewChange
-
-
-
-
Field Detail
-
queue
protected java.util.concurrent.BlockingQueue<Message> queue
-
remove_queue
protected java.util.List<Message> remove_queue
-
bundler_thread
protected java.lang.Thread bundler_thread
-
running
protected volatile boolean running
-
THREAD_NAME
protected static final java.lang.String THREAD_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
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()
-
removeQueueCapacity
public int removeQueueCapacity()
- Overrides:
removeQueueCapacityin classBaseBundler
-
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()
- 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
public void send(Message msg) throws java.lang.Exception
- Specified by:
sendin interfaceBundler- Overrides:
sendin classBaseBundler- Throws:
java.lang.Exception
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
addAndSendIfSizeExceeded
protected void addAndSendIfSizeExceeded(Message msg)
-
drain
protected void drain()
Takes all messages from the queue, adds them to the hashmap and then sends all bundled messages
-
-