diff -r da6c6f544dfb -r cb99c6d2af1b jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java Fri May 06 06:23:30 2016 -0700 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java Mon May 09 12:39:41 2016 +0300 @@ -714,22 +714,31 @@ } { - boolean r = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); - assertEquals(r, true, "weakCompareAndSet int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + } + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) vh.get(array, i); assertEquals(x, VALUE_2, "weakCompareAndSet int value"); } { - boolean r = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetAcquire int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSetAcquire int"); int x = (int) vh.get(array, i); assertEquals(x, VALUE_1, "weakCompareAndSetAcquire int"); } { - boolean r = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); - assertEquals(r, true, "weakCompareAndSetRelease int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); + } + assertEquals(success, true, "weakCompareAndSetRelease int"); int x = (int) vh.get(array, i); assertEquals(x, VALUE_2, "weakCompareAndSetRelease int"); } @@ -863,22 +872,31 @@ } { - boolean r = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); - assertEquals(r, true, "weakCompareAndSet int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + } + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) vh.get(array, i); assertEquals(x, VALUE_2, "weakCompareAndSet int value"); } { - boolean r = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetAcquire int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSetAcquire int"); int x = (int) vh.get(array, i); assertEquals(x, VALUE_1, "weakCompareAndSetAcquire int"); } { - boolean r = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); - assertEquals(r, true, "weakCompareAndSetRelease int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); + } + assertEquals(success, true, "weakCompareAndSetRelease int"); int x = (int) vh.get(array, i); assertEquals(x, VALUE_2, "weakCompareAndSetRelease int"); }