Is there a way to prevent ClosedByInterruptException?
In the following example, I have one file being used by two threads (in the real example I could have any number of threads) import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; public class A { static volatile boolean running = true; public static void main(String[] args) throws IOException, InterruptedException { String name = "delete.me"; new File(name).deleteOnExit(); RandomAccessFile raf = new RandomAccessFile(name, "rw"); FileChannel fc = raf.getChannel(); Thread monitor = new Thread(() -> { try { while (running) { System.out.println(name + " is " + (fc.size() >> 10) + " KB"); try { Thread.sleep(1000); } catch (InterruptedException e) { System.out.println(...