ARTEMIS-2062 Only attempt to refill credit when needed
Avoid firing the offerProducerCredit code when we know that the credit isnt low enough that a refill is needed, which avoids lock contention and garbage creation as each inbound message is processed.
This commit is contained in:
parent
09f9159eae
commit
960833d2be
|
@ -299,7 +299,9 @@ public class ProtonServerReceiverContext extends ProtonInitializable implements
|
|||
public void flow(int credits, int threshold) {
|
||||
// Use the SessionSPI to allocate producer credits, or default, always allocate credit.
|
||||
if (sessionSPI != null) {
|
||||
if (receiver.getCredit() <= threshold) {
|
||||
sessionSPI.offerProducerCredit(address, credits, threshold, receiver);
|
||||
}
|
||||
} else {
|
||||
connection.lock();
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue