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

Comparing jsr166/src/test/tck/ForkJoinTaskTest.java (file contents):
Revision 1.27 by jsr166, Mon Nov 22 07:50:50 2010 UTC vs.
Revision 1.28 by jsr166, Mon Nov 22 22:45:49 2010 UTC

# Line 93 | Line 93 | public class ForkJoinTaskTest extends JS
93          assertFalse(a.isCompletedAbnormally());
94          assertNull(a.getException());
95          assertSame(expected, a.getRawResult());
96 <        assertSame(expected, a.join());
96 >
97 >        {
98 >            Thread.currentThread().interrupt();
99 >            long t0 = System.nanoTime();
100 >            assertSame(expected, a.join());
101 >            assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS);
102 >            assertTrue(Thread.interrupted());
103 >        }
104 >
105 >        {
106 >            Thread.currentThread().interrupt();
107 >            long t0 = System.nanoTime();
108 >            a.quietlyJoin();        // should be no-op
109 >            assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS);
110 >            assertTrue(Thread.interrupted());
111 >        }
112 >
113          assertFalse(a.cancel(false));
114          assertFalse(a.cancel(true));
115          try {
# Line 115 | Line 131 | public class ForkJoinTaskTest extends JS
131          assertTrue(a.cancel(true));
132  
133          try {
134 +            Thread.currentThread().interrupt();
135              a.join();
136              shouldThrow();
137          } catch (CancellationException success) {
138 +            assertTrue(Thread.interrupted());
139          } catch (Throwable fail) { threadUnexpectedException(fail); }
140  
141 +        {
142 +            long t0 = System.nanoTime();
143 +            a.quietlyJoin();        // should be no-op
144 +            assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS);
145 +        }
146 +
147          try {
148              a.get();
149              shouldThrow();
# Line 144 | Line 168 | public class ForkJoinTaskTest extends JS
168          assertFalse(a.cancel(true));
169  
170          try {
171 +            Thread.currentThread().interrupt();
172              a.join();
173              shouldThrow();
174          } catch (Throwable expected) {
175 +            assertTrue(Thread.interrupted());
176              assertSame(t, expected);
177          }
178  
179 +        {
180 +            long t0 = System.nanoTime();
181 +            a.quietlyJoin();        // should be no-op
182 +            assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS);
183 +        }
184 +
185          try {
186              a.get();
187              shouldThrow();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines