Package org.jgroups.util
Class MaxOneThreadPerSender.Entry
- java.lang.Object
-
- org.jgroups.util.MaxOneThreadPerSender.Entry
-
- Enclosing class:
- MaxOneThreadPerSender
protected class MaxOneThreadPerSender.Entry extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected MessageBatchbatchprotected java.util.function.IntFunction<MessageBatch>batch_creatorprotected java.util.concurrent.locks.Locklockprotected java.util.concurrent.atomic.LongAdderqueued_batchesprotected java.util.concurrent.atomic.LongAdderqueued_msgsprotected booleanrunningprotected java.util.concurrent.atomic.LongAddersubmitted_batchesprotected java.util.concurrent.atomic.LongAddersubmitted_msgs
-
Constructor Summary
Constructors Modifier Constructor Description protectedEntry(java.util.function.IntFunction<MessageBatch> creator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanallowedToSubmitToThreadPool(Message msg)Either allows access to submit a task to the thread pool for delivery to the application, or queues the messageprotected booleanallowedToSubmitToThreadPool(MessageBatch msg_batch)protected voidprocess(Message msg, boolean loopback)protected voidprocess(MessageBatch batch)MaxOneThreadPerSender.Entryreset()protected voidsetRunning(boolean flag)protected voidsubmit(Message msg, boolean loopback)protected voidsubmit(MessageBatch mb)java.lang.StringtoString()protected booleanworkAvailable(MessageBatch msg_batch)Called byMaxOneThreadPerSender.BatchHandlerLoop.
-
-
-
Field Detail
-
lock
protected final java.util.concurrent.locks.Lock lock
-
running
protected boolean running
-
batch
protected MessageBatch batch
-
batch_creator
protected java.util.function.IntFunction<MessageBatch> batch_creator
-
submitted_msgs
protected final java.util.concurrent.atomic.LongAdder submitted_msgs
-
submitted_batches
protected final java.util.concurrent.atomic.LongAdder submitted_batches
-
queued_msgs
protected final java.util.concurrent.atomic.LongAdder queued_msgs
-
queued_batches
protected final java.util.concurrent.atomic.LongAdder queued_batches
-
-
Constructor Detail
-
Entry
protected Entry(java.util.function.IntFunction<MessageBatch> creator)
-
-
Method Detail
-
reset
public MaxOneThreadPerSender.Entry reset()
-
process
protected void process(Message msg, boolean loopback)
-
process
protected void process(MessageBatch batch)
-
submit
protected void submit(Message msg, boolean loopback)
-
submit
protected void submit(MessageBatch mb)
-
allowedToSubmitToThreadPool
protected boolean allowedToSubmitToThreadPool(Message msg)
Either allows access to submit a task to the thread pool for delivery to the application, or queues the message- Parameters:
msg- the message- Returns:
- true if the message can be submitted to the thread pool, or false (msg was queued)
-
allowedToSubmitToThreadPool
protected boolean allowedToSubmitToThreadPool(MessageBatch msg_batch)
-
workAvailable
protected boolean workAvailable(MessageBatch msg_batch)
Called byMaxOneThreadPerSender.BatchHandlerLoop. Atomically transfer messages from the entry's batch to this batch and returns true if messages were transferred. If not, sets running to false and returns false. In the latter case, the handler must terminate (or else, we could have multiple handler running).- Parameters:
msg_batch- the batch to which messages from this.batch should be transferred to.
-
setRunning
protected void setRunning(boolean flag)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-