public class NonBlockingCredit extends Credit
Modifier and Type | Field and Description |
---|---|
protected SizeBoundedQueue<Message> |
msg_queue |
protected static Consumer<Message> |
NO_OP_SEND_FUNCTION |
protected LongAdder |
num_queued |
protected boolean |
queuing |
protected Consumer<Message> |
send_function |
avg_blockings, credits_available, credits_left, last_credit_request, lock, num_blockings
Constructor and Description |
---|
NonBlockingCredit(long credits,
int max_size,
Lock lock) |
NonBlockingCredit(long credits,
int max_size,
Lock lock,
Consumer<Message> send_function) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
addToQueue(Message msg,
int length) |
boolean |
decrementIfEnoughCredits(Message msg,
int credits,
long timeout)
Decrements the sender's credits by the size of the message.
|
int |
getEnqueuedMessages() |
int |
getQueuedMessages() |
int |
getQueuedMessageSize() |
void |
increment(long credits,
long max_credits) |
boolean |
isQueuing() |
void |
reset() |
String |
toString() |
decrement, decrementAndGet, get, getAverageBlockTime, getNumBlockings, needToSendCreditRequest
protected final SizeBoundedQueue<Message> msg_queue
protected boolean queuing
protected final LongAdder num_queued
public NonBlockingCredit(long credits, int max_size, Lock lock)
public boolean isQueuing()
public int getQueuedMessages()
public int getQueuedMessageSize()
public int getEnqueuedMessages()
public boolean decrementIfEnoughCredits(Message msg, int credits, long timeout)
decrementIfEnoughCredits
in class Credit
msg
- The messagecredits
- The number of bytes to decrement the credits. Is Message.length()
.timeout
- Ignoredpublic void increment(long credits, long max_credits)
protected boolean addToQueue(Message msg, int length)
Copyright © 2018 JBoss, a division of Red Hat. All rights reserved.