Package org.jgroups.protocols
Class PerDestinationBundler
- java.lang.Object
-
- org.jgroups.protocols.PerDestinationBundler
-
- All Implemented Interfaces:
Bundler
public class PerDestinationBundler extends java.lang.Object implements Bundler
Queues messages per destination ('null' is a special destination), sending when the last sender thread to the same destination returns or max_size has been reached. This uses 1 thread per destination, so it won't scale to many cluster members (unless virtual threads are used).
See https://issues.redhat.com/browse/JGRP-2639 for details.- Since:
- 5.2.7
- Author:
- Bela Ban
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
PerDestinationBundler.SendBuffer
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<Address,PerDestinationBundler.SendBuffer>
dests
protected Address
local_addr
protected Log
log
protected int
max_size
Maximum number of bytes for messages to be queued until they are sent.protected MessageProcessingPolicy
msg_processing_policy
protected MsgStats
msg_stats
protected static Address
NULL
protected java.util.concurrent.atomic.LongAdder
num_batches_sent
protected java.util.concurrent.atomic.LongAdder
num_send_due_to_no_msgs
protected java.util.concurrent.atomic.LongAdder
num_sends_due_to_max_size
protected java.util.concurrent.atomic.LongAdder
num_single_msgs_sent
protected AverageMinMax
send_times
protected static java.lang.String
THREAD_NAME
protected java.util.concurrent.atomic.LongAdder
total_msgs_sent
protected TP
transport
-
Constructor Summary
Constructors Constructor Description PerDestinationBundler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
avgBatchSize()
int
getMaxSize()
Maximum number of bytes for messages to be queued until they are sentint
getQueueSize()
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.void
init(TP transport)
Called after creation of the bundlervoid
resetStats()
void
send(Message msg)
Bundler
setMaxSize(int s)
int
size()
The number of unsent messages in the bundlervoid
start()
Called afterBundler.init(TP)
void
stop()
void
viewChange(View view)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jgroups.protocols.Bundler
getCapacity, renameThread
-
-
-
-
Field Detail
-
max_size
protected int max_size
Maximum 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
-
total_msgs_sent
protected final java.util.concurrent.atomic.LongAdder total_msgs_sent
-
num_single_msgs_sent
protected final java.util.concurrent.atomic.LongAdder num_single_msgs_sent
-
num_batches_sent
protected final java.util.concurrent.atomic.LongAdder num_batches_sent
-
num_send_due_to_no_msgs
protected final java.util.concurrent.atomic.LongAdder num_send_due_to_no_msgs
-
num_sends_due_to_max_size
protected final java.util.concurrent.atomic.LongAdder num_sends_due_to_max_size
-
send_times
protected final AverageMinMax send_times
-
transport
protected TP transport
-
msg_stats
protected MsgStats msg_stats
-
msg_processing_policy
protected MessageProcessingPolicy msg_processing_policy
-
log
protected Log log
-
local_addr
protected Address local_addr
-
dests
protected final java.util.Map<Address,PerDestinationBundler.SendBuffer> dests
-
NULL
protected static final Address NULL
-
THREAD_NAME
protected static final java.lang.String THREAD_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
size
public int size()
Description copied from interface:Bundler
The number of unsent messages in the bundler
-
getQueueSize
public int getQueueSize()
Description copied from interface:Bundler
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. 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:
getQueueSize
in interfaceBundler
-
getMaxSize
public int getMaxSize()
Description copied from interface:Bundler
Maximum number of bytes for messages to be queued until they are sent- Specified by:
getMaxSize
in interfaceBundler
-
setMaxSize
public Bundler setMaxSize(int s)
- Specified by:
setMaxSize
in interfaceBundler
-
avgBatchSize
public double avgBatchSize()
-
resetStats
public void resetStats()
- Specified by:
resetStats
in interfaceBundler
-
init
public void init(TP transport)
Description copied from interface:Bundler
Called after creation of the bundler
-
start
public void start()
Description copied from interface:Bundler
Called afterBundler.init(TP)
-
send
public void send(Message msg) throws java.lang.Exception
-
viewChange
public void viewChange(View view)
- Specified by:
viewChange
in interfaceBundler
-
-