2020 2021 2022 // The following three initially uninitialized fields are exclusively 2023 // managed by class java.util.concurrent.ThreadLocalRandom. These 2024 // fields are used to build the high-performance PRNGs in the 2025 // concurrent code, and we can not risk accidental false sharing. 2026 // Hence, the fields are isolated with @Contended. 2027 2028 /** The current seed for a ThreadLocalRandom */ 2029 @sun.misc.Contended("tlr") 2030 long threadLocalRandomSeed; 2031 2032 /** Probe hash value; nonzero if threadLocalRandomSeed initialized */ 2033 @sun.misc.Contended("tlr") 2034 int threadLocalRandomProbe; 2035 2036 /** Secondary seed isolated from public ThreadLocalRandom sequence */ 2037 @sun.misc.Contended("tlr") 2038 int threadLocalRandomSecondarySeed; 2039 2040 /* Some private helper methods */ 2041 private native void setPriority0(int newPriority); 2042 private native void stop0(Object o); 2043 private native void suspend0(); 2044 private native void resume0(); 2045 private native void interrupt0(); 2046 private native void setNativeName(String name); 2047 } | 2020 2021 2022 // The following three initially uninitialized fields are exclusively 2023 // managed by class java.util.concurrent.ThreadLocalRandom. These 2024 // fields are used to build the high-performance PRNGs in the 2025 // concurrent code, and we can not risk accidental false sharing. 2026 // Hence, the fields are isolated with @Contended. 2027 2028 /** The current seed for a ThreadLocalRandom */ 2029 @sun.misc.Contended("tlr") 2030 long threadLocalRandomSeed; 2031 2032 /** Probe hash value; nonzero if threadLocalRandomSeed initialized */ 2033 @sun.misc.Contended("tlr") 2034 int threadLocalRandomProbe; 2035 2036 /** Secondary seed isolated from public ThreadLocalRandom sequence */ 2037 @sun.misc.Contended("tlr") 2038 int threadLocalRandomSecondarySeed; 2039 2040 private static long parkLastGlobalSeqOffset; 2041 private static long parkPriorityOffset; 2042 private static long nestingLevelOffset; 2043 2044 /* Some private helper methods */ 2045 private native void setPriority0(int newPriority); 2046 private native void stop0(Object o); 2047 private native void suspend0(); 2048 private native void resume0(); 2049 private native void interrupt0(); 2050 private native void setNativeName(String name); 2051 } |