2 |
|
* Written by Doug Lea with assistance from members of JCP JSR-166 |
3 |
|
* Expert Group and released to the public domain, as explained at |
4 |
|
* http://creativecommons.org/licenses/publicdomain |
5 |
< |
* Other contributors include Andrew Wright, Jeffrey Hayes, |
6 |
< |
* Pat Fisher, Mike Judd. |
5 |
> |
* Other contributors include Andrew Wright, Jeffrey Hayes, |
6 |
> |
* Pat Fisher, Mike Judd. |
7 |
|
*/ |
8 |
|
|
9 |
|
import java.util.concurrent.atomic.*; |
26 |
|
*/ |
27 |
|
public void testConstructor() { |
28 |
|
try{ |
29 |
< |
AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> |
29 |
> |
AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> |
30 |
|
a = AtomicIntegerFieldUpdater.newUpdater |
31 |
|
(AtomicIntegerFieldUpdaterTest.class, "y"); |
32 |
|
shouldThrow(); |
39 |
|
*/ |
40 |
|
public void testConstructor2() { |
41 |
|
try{ |
42 |
< |
AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> |
42 |
> |
AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> |
43 |
|
a = AtomicIntegerFieldUpdater.newUpdater |
44 |
|
(AtomicIntegerFieldUpdaterTest.class, "z"); |
45 |
|
shouldThrow(); |
52 |
|
*/ |
53 |
|
public void testConstructor3() { |
54 |
|
try{ |
55 |
< |
AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> |
55 |
> |
AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> |
56 |
|
a = AtomicIntegerFieldUpdater.newUpdater |
57 |
|
(AtomicIntegerFieldUpdaterTest.class, "w"); |
58 |
|
shouldThrow(); |
76 |
|
assertEquals(2,a.get(this)); |
77 |
|
a.set(this,-3); |
78 |
|
assertEquals(-3,a.get(this)); |
79 |
< |
|
79 |
> |
|
80 |
|
} |
81 |
|
|
82 |
|
/** |
95 |
|
assertEquals(2,a.get(this)); |
96 |
|
a.lazySet(this,-3); |
97 |
|
assertEquals(-3,a.get(this)); |
98 |
< |
|
98 |
> |
|
99 |
|
} |
100 |
|
|
101 |
|
/** |
150 |
|
|
151 |
|
/** |
152 |
|
* repeated weakCompareAndSet succeeds in changing value when equal |
153 |
< |
* to expected |
153 |
> |
* to expected |
154 |
|
*/ |
155 |
|
public void testWeakCompareAndSet() { |
156 |
|
AtomicIntegerFieldUpdater<AtomicIntegerFieldUpdaterTest> a; |