RFR: 8265100: (fs) WindowsFileStore.hashCode() should read cached hash code once

Alan Bateman alanb at openjdk.java.net
Tue Apr 13 05:40:58 UTC 2021


On Mon, 12 Apr 2021 23:11:04 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Please review this small request to clean up `WindowsFileStore.hashCode()`.

src/java.base/windows/classes/sun/nio/fs/WindowsFileStore.java line 55:

> 53:     private final String displayName;   // returned by toString
> 54: 
> 55:     private volatile int hashCode;

It doesn't needed to be volatile, it's okay to race in the hashCode method.

-------------

PR: https://git.openjdk.java.net/jdk/pull/3445


More information about the nio-dev mailing list