ARTEMIS-4108 Improving flush on large message fix
This commit is contained in:
parent
eb11b044af
commit
33567fca8d
|
@ -191,13 +191,22 @@ public class ProtonServerSenderContext extends ProtonInitializable implements Pr
|
|||
// If the draining is already running, then don't do anything
|
||||
if (draining.compareAndSet(false, true)) {
|
||||
final ProtonServerSenderContext plugSender = (ProtonServerSenderContext) serverConsumer.getProtocolContext();
|
||||
flushDrain(serverConsumer, plugSender);
|
||||
}
|
||||
} else {
|
||||
serverConsumer.receiveCredits(-1);
|
||||
}
|
||||
}
|
||||
|
||||
private void flushDrain(ServerConsumerImpl serverConsumer, ProtonServerSenderContext plugSender) {
|
||||
serverConsumer.forceDelivery(1, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
connection.runNow(() -> {
|
||||
if (pendingLargeMessage != null) {
|
||||
afterLargeMessage = () -> drained(plugSender);
|
||||
// retry the flush after the large message is done
|
||||
afterLargeMessage = () -> flushDrain(serverConsumer, plugSender);
|
||||
} else {
|
||||
drained(plugSender);
|
||||
}
|
||||
|
@ -208,10 +217,6 @@ public class ProtonServerSenderContext extends ProtonInitializable implements Pr
|
|||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
serverConsumer.receiveCredits(-1);
|
||||
}
|
||||
}
|
||||
|
||||
private void drained(ProtonServerSenderContext sender) {
|
||||
sender.reportDrained();
|
||||
|
|
Loading…
Reference in New Issue