Package org.jgroups.util
Class NonBlockingCreditMap
- java.lang.Object
-
- org.jgroups.util.CreditMap
-
- org.jgroups.util.NonBlockingCreditMap
-
public class NonBlockingCreditMap extends CreditMap
- Since:
- 4.0.4
- Author:
- Bela Ban
-
-
Field Summary
Fields Modifier and Type Field Description protected SizeBoundedQueue<Message>
msg_queue
protected static java.util.function.Consumer<Message>
NO_OP_SEND_FUNCTION
protected java.util.concurrent.atomic.LongAdder
num_queued
protected boolean
queuing
protected java.util.function.Consumer<Message>
send_function
-
Fields inherited from class org.jgroups.util.CreditMap
accumulated_credits, avg_block_time, credits, credits_available, done, lock, max_credits, min_credits, num_blockings
-
-
Constructor Summary
Constructors Constructor Description NonBlockingCreditMap(long max_credits, int max_size, java.util.concurrent.locks.Lock lock)
NonBlockingCreditMap(long max_credits, int max_size, java.util.concurrent.locks.Lock lock, java.util.function.Consumer<Message> send_function)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
addToQueue(Message msg, int length)
void
clear()
boolean
decrement(Message msg, int credits, long timeout)
Decrements credits bytes from all.int
getEnqueuedMessages()
int
getQueuedMessages()
int
getQueuedMessageSize()
boolean
isQueuing()
java.lang.Long
remove(Address key)
void
replenish(Address sender, long new_credits)
CreditMap
reset()
Sets this credit to be done and releases all blocked threads.void
resetStats()
java.lang.String
toString()
-
Methods inherited from class org.jgroups.util.CreditMap
computeLowestCredit, computeLowestCreditWithAccumulated, decrement, decrementAndAdd, flushAccumulatedCredits, get, getAccumulatedCredits, getAverageBlockTime, getMembersWithCreditsLessThan, getMembersWithInsufficientCredits, getMinCredits, getNumBlockings, keys, putIfAbsent, replenishAll
-
-
-
-
Field Detail
-
msg_queue
protected final SizeBoundedQueue<Message> msg_queue
-
queuing
protected boolean queuing
-
send_function
protected final java.util.function.Consumer<Message> send_function
-
NO_OP_SEND_FUNCTION
protected static final java.util.function.Consumer<Message> NO_OP_SEND_FUNCTION
-
num_queued
protected final java.util.concurrent.atomic.LongAdder num_queued
-
-
Constructor Detail
-
NonBlockingCreditMap
public NonBlockingCreditMap(long max_credits, int max_size, java.util.concurrent.locks.Lock lock)
-
NonBlockingCreditMap
public NonBlockingCreditMap(long max_credits, int max_size, java.util.concurrent.locks.Lock lock, java.util.function.Consumer<Message> send_function)
-
-
Method Detail
-
isQueuing
public boolean isQueuing()
-
getQueuedMessages
public int getQueuedMessages()
-
getQueuedMessageSize
public int getQueuedMessageSize()
-
getEnqueuedMessages
public int getEnqueuedMessages()
-
resetStats
public void resetStats()
- Overrides:
resetStats
in classCreditMap
-
decrement
public boolean decrement(Message msg, int credits, long timeout)
Description copied from class:CreditMap
Decrements credits bytes from all. Returns true if successful, or false if not. Blocks for timeout ms (if greater than 0).
-
replenish
public void replenish(Address sender, long new_credits)
-
reset
public CreditMap reset()
Description copied from class:CreditMap
Sets this credit to be done and releases all blocked threads. This is not revertable; a new credit has to be created
-
addToQueue
protected boolean addToQueue(Message msg, int length)
-
-