ARTEMIS-3084 Avoid pending IO to close files

This commit is contained in:
Clebert Suconic 2021-02-03 16:55:05 -05:00
parent 89aca1f630
commit c47122ea15
2 changed files with 4 additions and 25 deletions

View File

@ -77,13 +77,6 @@ public interface SequentialFile {
void write(EncodingSupport bytes, boolean sync) throws Exception; void write(EncodingSupport bytes, boolean sync) throws Exception;
default void refUp() {
}
default void refDown() {
}
/** /**
* Write directly to the file without using any buffer * Write directly to the file without using any buffer

View File

@ -80,16 +80,6 @@ public class AIOSequentialFile extends AbstractSequentialFile {
this.aioFactory = factory; this.aioFactory = factory;
} }
@Override
public void refUp() {
pendingCallbacks.countUp();
}
@Override
public void refDown() {
pendingCallbacks.countDown();
}
@Override @Override
public ByteBuffer map(int position, long size) throws IOException { public ByteBuffer map(int position, long size) throws IOException {
return null; return null;
@ -337,12 +327,10 @@ public class AIOSequentialFile extends AbstractSequentialFile {
} }
void done(AIOSequentialFileFactory.AIOSequentialCallback callback) { void done(AIOSequentialFileFactory.AIOSequentialCallback callback) {
pendingCallbacks.countDown();
if (callback.writeSequence == -1) { if (callback.writeSequence == -1) {
try { callback.sequentialDone();
callback.sequentialDone();
} finally {
pendingCallbacks.countDown();
}
} }
if (callback.writeSequence == nextReadSequence) { if (callback.writeSequence == nextReadSequence) {
@ -350,9 +338,8 @@ public class AIOSequentialFile extends AbstractSequentialFile {
try { try {
callback.sequentialDone(); callback.sequentialDone();
} finally { } finally {
pendingCallbacks.countDown(); flushCallbacks();
} }
flushCallbacks();
} else { } else {
pendingCallbackList.add(callback); pendingCallbackList.add(callback);
} }
@ -366,7 +353,6 @@ public class AIOSequentialFile extends AbstractSequentialFile {
callback.sequentialDone(); callback.sequentialDone();
} finally { } finally {
nextReadSequence++; nextReadSequence++;
pendingCallbacks.countDown();
} }
} }
} }