Package org.jgroups.util
Class MaxOneThreadPerSender
- java.lang.Object
-
- org.jgroups.util.SubmitToThreadPool
-
- org.jgroups.util.MaxOneThreadPerSender
-
- All Implemented Interfaces:
MessageProcessingPolicy
public class MaxOneThreadPerSender extends SubmitToThreadPool
MessageProcessingPolicy
which processes regular messages and message batches by assigning a max of 1 thread per message from the same sender. So if we have sender A, B, C and D, we'll have no more than 4 threads handling regular unicasts and 4 threads handling regular multicasts.See JGRP-2143 for details.
- Since:
- 4.0
- Author:
- Bela Ban
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
MaxOneThreadPerSender.BatchHandlerLoop
protected class
MaxOneThreadPerSender.Entry
protected class
MaxOneThreadPerSender.MessageTable
-
Nested classes/interfaces inherited from class org.jgroups.util.SubmitToThreadPool
SubmitToThreadPool.BatchHandler, SubmitToThreadPool.SingleLoopbackHandler, SubmitToThreadPool.SingleMessageHandler, SubmitToThreadPool.SingleMessageHandlerWithClusterName
-
-
Field Summary
Fields Modifier and Type Field Description protected int
max_buffer_size
protected MaxOneThreadPerSender.MessageTable
mcasts
protected boolean
resize
protected MaxOneThreadPerSender.MessageTable
ucasts
-
Fields inherited from class org.jgroups.util.SubmitToThreadPool
log, tp, tp_id
-
-
Constructor Summary
Constructors Constructor Description MaxOneThreadPerSender()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
Called before the transport is stoppedjava.lang.String
dump()
void
init(TP transport)
Called after creation.void
loopback(Message msg, boolean oob, boolean internal)
Process a message that was not received from the transport but from above (e.g.void
process(Message msg, boolean oob, boolean internal)
Process a message received from the transportvoid
process(MessageBatch batch, boolean oob, boolean internal)
Process a batch received from the transportvoid
reset()
To reset statsvoid
viewChange(java.util.List<Address> members)
-
Methods inherited from class org.jgroups.util.SubmitToThreadPool
removeAndDispatchNonBundledMessages
-
-
-
-
Field Detail
-
mcasts
protected final MaxOneThreadPerSender.MessageTable mcasts
-
ucasts
protected final MaxOneThreadPerSender.MessageTable ucasts
-
max_buffer_size
protected int max_buffer_size
-
resize
protected boolean resize
-
-
Method Detail
-
dump
public java.lang.String dump()
-
reset
public void reset()
Description copied from interface:MessageProcessingPolicy
To reset stats
-
init
public void init(TP transport)
Description copied from interface:MessageProcessingPolicy
Called after creation. Implementations may want to cache the transport reference to get access to thread pools, message counters etc- Specified by:
init
in interfaceMessageProcessingPolicy
- Overrides:
init
in classSubmitToThreadPool
-
destroy
public void destroy()
Description copied from interface:MessageProcessingPolicy
Called before the transport is stopped
-
loopback
public void loopback(Message msg, boolean oob, boolean internal)
Description copied from interface:MessageProcessingPolicy
Process a message that was not received from the transport but from above (e.g. the channel or a protocol), and needs to be looped back up because (1) the destination address is null (every multicast message is looped back) or (2) the destination address is the sender's address (unicast message to self).
A message that is looped back can bypass cluster name matching.- Specified by:
loopback
in interfaceMessageProcessingPolicy
- Overrides:
loopback
in classSubmitToThreadPool
- Parameters:
msg
- the message to be looped back up the stack.oob
- true if the message is an OOB messageinternal
- true if the message is internal
-
process
public void process(Message msg, boolean oob, boolean internal)
Description copied from interface:MessageProcessingPolicy
Process a message received from the transport- Specified by:
process
in interfaceMessageProcessingPolicy
- Overrides:
process
in classSubmitToThreadPool
- Parameters:
msg
- the messageoob
- true if the message is an OOB messageinternal
- true if the message is internal
-
process
public void process(MessageBatch batch, boolean oob, boolean internal)
Description copied from interface:MessageProcessingPolicy
Process a batch received from the transport- Specified by:
process
in interfaceMessageProcessingPolicy
- Overrides:
process
in classSubmitToThreadPool
- Parameters:
batch
- the batchoob
- true if the batch contains only OOB messagesinternal
- true if the batch contains only internal messages (or internal and OOB messages)
-
viewChange
public void viewChange(java.util.List<Address> members)
-
-