[9] RFR 8166253: (ch) FileLock object can get GC'd and result in unexpected release of file lock
Daniel Fuchs
daniel.fuchs at oracle.com
Tue Jan 30 10:16:33 UTC 2018
Hi Brian,
On 30/01/2018 01:23, Brian Burkhalter wrote:
> The proposed fix is:
>
> http://cr.openjdk.java.net/~bpb/8166253/webrev.03/
> <http://cr.openjdk.java.net/%7Ebpb/8166253/webrev.03/>
>
This is not a full-fledged review - just a comment:
92 private static class FileLockReference extends
WeakReference<FileLock>
93 implements FileLockListener {
94 private FileKey fileKey;
95
96 // Mirror of FileLock state for use when the lock object
is no longer
97 // weakly reachable but the native lock has not yet been
released.
98 private final long position;
99 private final long size;
100 private boolean isLockReleased;
Should fileKey be made final (AFAICS the field
is never mutated) and should isLockReleased
be volatile (appears that it could be mutated/read
from different threads)?
best regards,
-- daniel
More information about the nio-dev
mailing list