What happens when you get a read error while accessing a memory mapped file? Let's try it:
RandomAccessFile raf = new RandomAccessFile("\\\\server\\share\\filename", "r");FileChannel channel = raf.getChannel();MappedByteBuffer map = channel.map(FileChannel.MapMode.READ_ONLY, 0, 5 * 1024 * 1024);map.get(10 * 1024);System.out.println("read byte at 10K -- waiting");Thread.sleep(5000);map.get(500 * 1024);System.out.println("read byte at 500K");
Running this on JDK 1.6 (x64) and removing the network cable during the sleep will result in an Internal Error in the VM. Not exactly what I had hoped for.
Interestingly, on IKVM doing the same results in a cli.System.Runtime.InteropServices.SEHException being thrown.
I apologize for the lameness of this, but the comment spam was driving me nuts.
In order to be able to post a comment, you need to answer a simple question. Hopefully this question
is easy enough not to annoy serious commenters, but hard enough to keep the spammers away.
Anti-Spam Question: What method on java.lang.System returns an object's original hashcode (i.e. the
one that would be returned by java.lang.Object.hashCode() if it wasn't overridden)? (case is significant)
Powered by: newtelligence dasBlog 2.3.12105.0
© Copyright 2017, Jeroen Frijters