ARTEMIS-3084 Avoid pending IO to close files
This commit is contained in:
parent
89aca1f630
commit
c47122ea15
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue