You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2021/02/04 00:57:52 UTC
[activemq-artemis] branch master updated: ARTEMIS-3084 Avoid
pending IO to close files
This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/master by this push:
new c47122e ARTEMIS-3084 Avoid pending IO to close files
c47122e is described below
commit c47122ea1595cdba519f4a2d17ccc4fab9da33ea
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Wed Feb 3 16:55:05 2021 -0500
ARTEMIS-3084 Avoid pending IO to close files
---
.../activemq/artemis/core/io/SequentialFile.java | 7 -------
.../artemis/core/io/aio/AIOSequentialFile.java | 22 ++++------------------
2 files changed, 4 insertions(+), 25 deletions(-)
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 e65eb7e..328ffe6 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 0e9508b..dc87627 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
@@ -81,16 +81,6 @@ public class AIOSequentialFile extends AbstractSequentialFile {
}
@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();
}
}
}