1 |
|
/* |
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 |
4 |
> |
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
|
* Other contributors include Andrew Wright, Jeffrey Hayes, |
6 |
|
* Pat Fisher, Mike Judd. |
7 |
|
*/ |
34 |
|
} catch (RuntimeException success) {} |
35 |
|
} |
36 |
|
|
37 |
– |
|
37 |
|
/** |
38 |
|
* construction with field not of given type throws RuntimeException |
39 |
|
*/ |
59 |
|
} |
60 |
|
|
61 |
|
/** |
62 |
< |
* get returns the last value set or assigned |
62 |
> |
* get returns the last value set or assigned |
63 |
|
*/ |
64 |
|
public void testGetSet() { |
65 |
|
AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer>a; |
77 |
|
} |
78 |
|
|
79 |
|
/** |
80 |
< |
* get returns the last value lazySet by same thread |
80 |
> |
* get returns the last value lazySet by same thread |
81 |
|
*/ |
82 |
|
public void testGetLazySet() { |
83 |
|
AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer>a; |
105 |
|
return; |
106 |
|
} |
107 |
|
x = one; |
108 |
< |
assertTrue(a.compareAndSet(this,one,two)); |
109 |
< |
assertTrue(a.compareAndSet(this,two,m4)); |
110 |
< |
assertSame(m4,a.get(this)); |
111 |
< |
assertFalse(a.compareAndSet(this,m5,seven)); |
108 |
> |
assertTrue(a.compareAndSet(this, one, two)); |
109 |
> |
assertTrue(a.compareAndSet(this, two, m4)); |
110 |
> |
assertSame(m4, a.get(this)); |
111 |
> |
assertFalse(a.compareAndSet(this, m5, seven)); |
112 |
|
assertFalse(seven == a.get(this)); |
113 |
< |
assertTrue(a.compareAndSet(this,m4,seven)); |
113 |
> |
assertTrue(a.compareAndSet(this, m4, seven)); |
114 |
|
assertSame(seven,a.get(this)); |
115 |
|
} |
116 |
|
|