File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed
main/java/com/github/benmanes/caffeine/cache
test/java/com/github/benmanes/caffeine/cache Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -340,7 +340,7 @@ static final class VarHandleProbe implements Probe {
340340
341341 /** Uses a thread local to maintain a random probe value. */
342342 static final class ThreadLocalProbe implements Probe {
343- static final ThreadLocal <int []> threadHashCode = new ThreadLocal <>( );
343+ static final ThreadLocal <int []> threadHashCode = ThreadLocal . withInitial (() -> new int [ 1 ] );
344344
345345 @ Override public int get () {
346346 return threadHashCode .get ()[0 ];
@@ -351,7 +351,7 @@ static final class ThreadLocalProbe implements Probe {
351351 @ Override public void initialize () {
352352 // Avoid zero to allow xorShift rehash
353353 int hash = 1 | ThreadLocalRandom .current ().nextInt ();
354- threadHashCode .set ( new int [] { hash }) ;
354+ threadHashCode .get ()[ 0 ] = hash ;
355355 }
356356 }
357357}
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ public void init(FakeBuffer<Integer> buffer) {
4949
5050 @ Test (dataProvider = "probes" )
5151 public void probe (Probe probe ) {
52+ probe .get ();
5253 probe .initialize ();
5354 assertThat (probe .get (), is (not (0 )));
5455
You can’t perform that action at this time.
0 commit comments