Package org.jgroups.util
Class SubmitToThreadPool
- java.lang.Object
-
- org.jgroups.util.SubmitToThreadPool
-
- All Implemented Interfaces:
MessageProcessingPolicy
- Direct Known Subclasses:
MaxOneThreadPerSender
,PassRegularMessagesUpDirectly
public class SubmitToThreadPool extends java.lang.Object implements MessageProcessingPolicy
Default message processing policy. Submits all received messages and batches to the thread pool- Since:
- 4.0
- Author:
- Bela Ban
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
SubmitToThreadPool.BatchHandler
class
SubmitToThreadPool.SingleLoopbackHandler
class
SubmitToThreadPool.SingleMessageHandler
protected class
SubmitToThreadPool.SingleMessageHandlerWithClusterName
-
Constructor Summary
Constructors Constructor Description SubmitToThreadPool()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TP
getTransport()
void
init(TP transport)
Called after creation.boolean
loopback(Message msg, boolean oob)
Process a message that was not received from the transport but from above (e.g.boolean
loopback(MessageBatch batch, boolean oob)
boolean
process(Message msg, boolean oob)
Process a message received from the transportboolean
process(MessageBatch batch, boolean oob)
Process a batch received from the transportprotected boolean
removeAndDispatchNonBundledMessages(MessageBatch oob_batch, boolean loopback)
Removes messages with flags DONT_BUNDLE and OOB set and executes them in the oob or internal thread pool.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jgroups.stack.MessageProcessingPolicy
destroy, reset
-
-
-
-
Method Detail
-
getTransport
protected TP getTransport()
-
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
-
loopback
public boolean loopback(Message msg, boolean oob)
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
- Parameters:
msg
- the message to be looped back up the stack.oob
- true if the message is an OOB message- Returns:
-
loopback
public boolean loopback(MessageBatch batch, boolean oob)
- Specified by:
loopback
in interfaceMessageProcessingPolicy
-
process
public boolean process(Message msg, boolean oob)
Description copied from interface:MessageProcessingPolicy
Process a message received from the transport- Specified by:
process
in interfaceMessageProcessingPolicy
- Parameters:
msg
- the messageoob
- true if the message is an OOB message- Returns:
-
process
public boolean process(MessageBatch batch, boolean oob)
Description copied from interface:MessageProcessingPolicy
Process a batch received from the transport- Specified by:
process
in interfaceMessageProcessingPolicy
- Parameters:
batch
- the batchoob
- true if the batch contains only OOB messages- Returns:
-
removeAndDispatchNonBundledMessages
protected boolean removeAndDispatchNonBundledMessages(MessageBatch oob_batch, boolean loopback)
Removes messages with flags DONT_BUNDLE and OOB set and executes them in the oob or internal thread pool. JGRP-1737 Returns true if at least one message was removed
-
-