Fix synchronization

This commit is contained in:
Andrea Cavalli 2022-11-10 00:40:48 +01:00
parent 4a5a42b7fd
commit 858d1f86a6

View File

@ -37,10 +37,10 @@ class QueueToConsumer<T> implements IQueueToConsumer<T> {
boolean crashed = true; boolean crashed = true;
try { try {
if (consumer.tryConsume(value)) { if (consumer.tryConsume(value)) {
crashed = false;
shouldAdd = false; shouldAdd = false;
preAddQueued.decrementAndGet(); preAddQueued.decrementAndGet();
} }
crashed = false;
} finally { } finally {
if (crashed) { if (crashed) {
shouldAdd = false; shouldAdd = false;