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;
default void refUp() {
}
default void refDown() {
}
/**
* Write directly to the file without using any buffer

View File

@ -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();
}
}
}