ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/AtomicReferenceFieldUpdaterTest.java
(Generate patch)

Comparing jsr166/src/test/tck/AtomicReferenceFieldUpdaterTest.java (file contents):
Revision 1.7 by dl, Mon Dec 29 19:05:40 2003 UTC vs.
Revision 1.8 by dl, Tue Jan 20 20:20:56 2004 UTC

# Line 66 | Line 66 | public class AtomicReferenceFieldUpdater
66       *  get returns the last value set or assigned
67       */
68      public void testGetSet(){
69 <        AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer>a = AtomicReferenceFieldUpdater.newUpdater(AtomicReferenceFieldUpdaterTest.class, Integer.class, "x");
69 >        AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer>a;
70 >        try {
71 >            a = AtomicReferenceFieldUpdater.newUpdater(AtomicReferenceFieldUpdaterTest.class, Integer.class, "x");
72 >        } catch (RuntimeException ok) {
73 >            return;
74 >        }
75          x = one;
76          assertEquals(one,a.get(this));
77          a.set(this,two);
# Line 79 | Line 84 | public class AtomicReferenceFieldUpdater
84       * compareAndSet succeeds in changing value if equal to expected else fails
85       */
86      public void testCompareAndSet(){
87 <        AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer>a = AtomicReferenceFieldUpdater.newUpdater(AtomicReferenceFieldUpdaterTest.class, Integer.class, "x");
87 >        AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer>a;
88 >        try {
89 >            a = AtomicReferenceFieldUpdater.newUpdater(AtomicReferenceFieldUpdaterTest.class, Integer.class, "x");
90 >        } catch (RuntimeException ok) {
91 >            return;
92 >        }
93          x = one;
94          assertTrue(a.compareAndSet(this,one,two));
95          assertTrue(a.compareAndSet(this,two,m4));
# Line 96 | Line 106 | public class AtomicReferenceFieldUpdater
106       */
107      public void testCompareAndSetInMultipleThreads() {
108          x = one;
109 <        final AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer>a = AtomicReferenceFieldUpdater.newUpdater(AtomicReferenceFieldUpdaterTest.class, Integer.class, "x");
109 >        final AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer>a;
110 >        try {
111 >            a = AtomicReferenceFieldUpdater.newUpdater(AtomicReferenceFieldUpdaterTest.class, Integer.class, "x");
112 >        } catch (RuntimeException ok) {
113 >            return;
114 >        }
115  
116          Thread t = new Thread(new Runnable() {
117                  public void run() {
# Line 119 | Line 134 | public class AtomicReferenceFieldUpdater
134       * to expected
135       */
136      public void testWeakCompareAndSet(){
137 <        AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer>a = AtomicReferenceFieldUpdater.newUpdater(AtomicReferenceFieldUpdaterTest.class, Integer.class, "x");
137 >        AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer>a;
138 >        try {
139 >            a = AtomicReferenceFieldUpdater.newUpdater(AtomicReferenceFieldUpdaterTest.class, Integer.class, "x");
140 >        } catch (RuntimeException ok) {
141 >            return;
142 >        }
143          x = one;
144          while(!a.weakCompareAndSet(this,one,two));
145          while(!a.weakCompareAndSet(this,two,m4));
# Line 132 | Line 152 | public class AtomicReferenceFieldUpdater
152       * getAndSet returns previous value and sets to given value
153       */
154      public void testGetAndSet(){
155 <        AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer>a = AtomicReferenceFieldUpdater.newUpdater(AtomicReferenceFieldUpdaterTest.class, Integer.class, "x");
155 >        AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer>a;
156 >        try {
157 >            a = AtomicReferenceFieldUpdater.newUpdater(AtomicReferenceFieldUpdaterTest.class, Integer.class, "x");
158 >        } catch (RuntimeException ok) {
159 >            return;
160 >        }
161          x = one;
162          assertEquals(one,a.getAndSet(this, zero));
163          assertEquals(zero,a.getAndSet(this,m10));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines