Class MaxOneThreadPerSender
java.lang.Object
org.jgroups.util.SubmitToThreadPool
org.jgroups.util.MaxOneThreadPerSender
- All Implemented Interfaces:
Lifecycle, MessageProcessingPolicy
- Direct Known Subclasses:
UnbatchOOBBatches
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 senders 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.
When using virtual threads, we probably don't need this anymore, and can use a virtual thread to send messages /
message batches directly up to UNICAST or NAKACK.
- Since:
- 4.0
- Author:
- Bela Ban
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classprotected classNested classes/interfaces inherited from class SubmitToThreadPool
SubmitToThreadPool.BatchHandler, SubmitToThreadPool.SingleMessageHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected final MaxOneThreadPerSender.MessageTableprotected intprotected final MaxOneThreadPerSender.MessageTableFields inherited from class SubmitToThreadPool
log, tp -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintbatchCapacity(int c) voiddestroy()Called before the transport is stoppeddump()booleanProcess a message that was not received from the transport but from above (e.g.booleanloopback(MessageBatch batch, boolean oob) booleanProcess a message received from the transportbooleanprocess(MessageBatch batch, boolean oob) Process a batch received from the transportintqueueCapacity(int c) voidreset()To reset statsvoidviewChange(List<Address> members) Methods inherited from class SubmitToThreadPool
getTransport, init, removeAndDispatchNonBundledMessages
-
Field Details
-
mcasts
-
ucasts
-
batch_capacity
protected int batch_capacity -
queue_capacity
protected int queue_capacity
-
-
Constructor Details
-
MaxOneThreadPerSender
public MaxOneThreadPerSender()
-
-
Method Details
-
batchCapacity
public int batchCapacity() -
batchCapacity
-
queueCapacity
public int queueCapacity() -
queueCapacity
-
dump
-
reset
-
destroy
public void destroy()Description copied from interface:MessageProcessingPolicyCalled before the transport is stopped -
loopback
Description copied from interface:MessageProcessingPolicyProcess 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:
loopbackin interfaceMessageProcessingPolicy- Overrides:
loopbackin classSubmitToThreadPool- Parameters:
msg- the message to be looped back up the stack.oob- true if the message is an OOB message- Returns:
-
loopback
- Specified by:
loopbackin interfaceMessageProcessingPolicy- Overrides:
loopbackin classSubmitToThreadPool
-
process
Description copied from interface:MessageProcessingPolicyProcess a message received from the transport- Specified by:
processin interfaceMessageProcessingPolicy- Overrides:
processin classSubmitToThreadPool- Parameters:
msg- the messageoob- true if the message is an OOB message- Returns:
-
process
Description copied from interface:MessageProcessingPolicyProcess a batch received from the transport- Specified by:
processin interfaceMessageProcessingPolicy- Overrides:
processin classSubmitToThreadPool- Parameters:
batch- the batchoob- true if the batch contains only OOB messages- Returns:
-
viewChange
-