Skip to content

Commit

Permalink
Ignore an exception when already closed.
Browse files Browse the repository at this point in the history
  • Loading branch information
broneill committed Aug 29, 2024
1 parent 48ef18b commit 8ea4f21
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/java/org/cojen/tupl/core/LockedFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.io.IOException;
import java.io.RandomAccessFile;

import java.nio.channels.ClosedChannelException;
import java.nio.channels.FileLock;
import java.nio.channels.OverlappingFileLockException;

Expand Down Expand Up @@ -87,8 +88,13 @@ final class LockedFile implements Closeable {
@Override
public void close() throws IOException {
if (mLock != null) {
mLock.close();
try {
mLock.close();
} catch (ClosedChannelException e) {
// Ignore.
}
}

if (mRaf != null) {
mRaf.close();
}
Expand Down

0 comments on commit 8ea4f21

Please sign in to comment.