Sean,
The changes look good, though I haven't gone through the test in much
detail!
One question that is not directly related to your changes, but may be
applicable.
Shouldn't the close on FileChannel also check the value of the use count
before closing the native fd? For example:
raf = new RandomAccessFile("test1", "rw");
fd = raf.getFD();
fos = new FileOutputStream(fd);
fos.getChannel();
fis = new FileInputStream(fd);
fos.close()
fis.read() <<<<<<< will this fail ????
Yes the channel should be closed, but shouldn't the
FileChannelImpl.close itself decrement the use count and not close the
fd if it is still in use?
-Chris
On 08/09/2011 18:11, Seán Coffey wrote:
http://bugs.sun.com/view_bug.do?bug_id=7082769
webrev : http://cr.openjdk.java.net/~coffeys/webrev.7082769.7087019.jdk8/
Bug fix where we ensure that the fd object is not disposed of until all
streams are closed out.
Testcase is a bulked up version of CR 6322678 (which wasn't committed at
time of 6322678 fix). It includes create/close() calls for
FileInputStream/FileOutputStream/RandomAccessFile which all reference
the same file descriptor. Multi threaded access to the same file
descriptor is also tested.
Typo fix also as per http://bugs.sun.com/view_bug.do?bug_id=7087019 also
included.
regards,
Sean.