diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/SequentialFile.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/SequentialFile.java index e65eb7e09d..328ffe688e 100644 --- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/SequentialFile.java +++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/SequentialFile.java @@ -77,13 +77,6 @@ public interface SequentialFile { void write(EncodingSupport bytes, boolean sync) throws Exception; - default void refUp() { - - } - - default void refDown() { - - } /** * Write directly to the file without using any buffer diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFile.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFile.java index 0e9508b53a..dc87627332 100644 --- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFile.java +++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFile.java @@ -80,16 +80,6 @@ public class AIOSequentialFile extends AbstractSequentialFile { this.aioFactory = factory; } - @Override - public void refUp() { - pendingCallbacks.countUp(); - } - - @Override - public void refDown() { - pendingCallbacks.countDown(); - } - @Override public ByteBuffer map(int position, long size) throws IOException { return null; @@ -337,12 +327,10 @@ public class AIOSequentialFile extends AbstractSequentialFile { } void done(AIOSequentialFileFactory.AIOSequentialCallback callback) { + pendingCallbacks.countDown(); + if (callback.writeSequence == -1) { - try { - callback.sequentialDone(); - } finally { - pendingCallbacks.countDown(); - } + callback.sequentialDone(); } if (callback.writeSequence == nextReadSequence) { @@ -350,9 +338,8 @@ public class AIOSequentialFile extends AbstractSequentialFile { try { callback.sequentialDone(); } finally { - pendingCallbacks.countDown(); + flushCallbacks(); } - flushCallbacks(); } else { pendingCallbackList.add(callback); } @@ -366,7 +353,6 @@ public class AIOSequentialFile extends AbstractSequentialFile { callback.sequentialDone(); } finally { nextReadSequence++; - pendingCallbacks.countDown(); } } }