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;
|
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
|
||||||
|
|
|
@ -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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue