Ignore closed channel exception when closing the channel lock

This commit is contained in:
AsamK 2020-06-05 12:14:04 +02:00
parent a83924238f
commit 4177deccf1

View file

@ -38,6 +38,7 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.RandomAccessFile; import java.io.RandomAccessFile;
import java.nio.channels.Channels; import java.nio.channels.Channels;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.FileChannel; import java.nio.channels.FileChannel;
import java.nio.channels.FileLock; import java.nio.channels.FileLock;
import java.util.Collection; import java.util.Collection;
@ -429,7 +430,10 @@ public class SignalAccount implements Closeable {
@Override @Override
public void close() throws IOException { public void close() throws IOException {
synchronized (fileChannel) { synchronized (fileChannel) {
lock.close(); try {
lock.close();
} catch (ClosedChannelException ignored) {
}
fileChannel.close(); fileChannel.close();
} }
} }