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

Comparing jsr166/src/test/tck/ScheduledExecutorTest.java (file contents):
Revision 1.23 by jsr166, Mon Nov 16 04:57:10 2009 UTC vs.
Revision 1.24 by jsr166, Mon Nov 16 05:30:08 2009 UTC

# Line 33 | Line 33 | public class ScheduledExecutorTest exten
33              try { p1.shutdown(); } catch (SecurityException ok) { return; }
34              try {
35                  Thread.sleep(MEDIUM_DELAY_MS);
36 <            } catch (InterruptedException e){
36 >            } catch (InterruptedException e) {
37                  unexpectedException();
38              }
39              assertTrue(runnable.done);
40              try { p1.shutdown(); } catch (SecurityException ok) { return; }
41              joinPool(p1);
42          }
43 <        catch (Exception e){
43 >        catch (Exception e) {
44              unexpectedException();
45          }
46  
# Line 61 | Line 61 | public class ScheduledExecutorTest exten
61              assertEquals(Boolean.TRUE, f.get());
62              try { p1.shutdown(); } catch (SecurityException ok) { return; }
63              joinPool(p1);
64 <        } catch (RejectedExecutionException e){}
65 <        catch (Exception e){
64 >        } catch (RejectedExecutionException e) {}
65 >        catch (Exception e) {
66              e.printStackTrace();
67              unexpectedException();
68          }
# Line 82 | Line 82 | public class ScheduledExecutorTest exten
82              assertTrue(runnable.done);
83              try { p1.shutdown(); } catch (SecurityException ok) { return; }
84              joinPool(p1);
85 <        } catch (Exception e){
85 >        } catch (Exception e) {
86              unexpectedException();
87          }
88      }
# Line 100 | Line 100 | public class ScheduledExecutorTest exten
100              assertTrue(runnable.done);
101              h.cancel(true);
102              joinPool(p1);
103 <        } catch (Exception e){
103 >        } catch (Exception e) {
104              unexpectedException();
105          }
106      }
# Line 123 | Line 123 | public class ScheduledExecutorTest exten
123              assertTrue(runnable.done);
124              h.cancel(true);
125              joinPool(p1);
126 <        } catch (Exception e){
126 >        } catch (Exception e) {
127              unexpectedException();
128          }
129      }
# Line 145 | Line 145 | public class ScheduledExecutorTest exten
145              assertTrue(c >= SMALL_DELAY_MS / SHORT_DELAY_MS);
146              assertTrue(c <= SMALL_DELAY_MS + SHORT_DELAY_MS);
147              joinPool(p1);
148 <        } catch (Exception e){
148 >        } catch (Exception e) {
149              unexpectedException();
150          }
151      }
# Line 165 | Line 165 | public class ScheduledExecutorTest exten
165              assertTrue(c >= SMALL_DELAY_MS / SHORT_DELAY_MS);
166              assertTrue(c <= SMALL_DELAY_MS + SHORT_DELAY_MS);
167              joinPool(p1);
168 <        } catch (Exception e){
168 >        } catch (Exception e) {
169              unexpectedException();
170          }
171      }
# Line 180 | Line 180 | public class ScheduledExecutorTest exten
180              se = new ScheduledThreadPoolExecutor(1);
181              se.execute(null);
182              shouldThrow();
183 <        } catch (NullPointerException success){}
184 <        catch (Exception e){
183 >        } catch (NullPointerException success) {}
184 >        catch (Exception e) {
185              unexpectedException();
186          }
187  
# Line 197 | Line 197 | public class ScheduledExecutorTest exten
197              TrackedCallable callable = null;
198              Future f = se.schedule(callable, SHORT_DELAY_MS, TimeUnit.MILLISECONDS);
199              shouldThrow();
200 <        } catch (NullPointerException success){}
201 <        catch (Exception e){
200 >        } catch (NullPointerException success) {}
201 >        catch (Exception e) {
202              unexpectedException();
203          }
204          joinPool(se);
# Line 214 | Line 214 | public class ScheduledExecutorTest exten
214              se.schedule(new NoOpRunnable(),
215                          MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
216              shouldThrow();
217 <        } catch (RejectedExecutionException success){
217 >        } catch (RejectedExecutionException success) {
218          } catch (SecurityException ok) {
219          }
220  
# Line 232 | Line 232 | public class ScheduledExecutorTest exten
232              se.schedule(new NoOpCallable(),
233                          MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
234              shouldThrow();
235 <        } catch (RejectedExecutionException success){
235 >        } catch (RejectedExecutionException success) {
236          } catch (SecurityException ok) {
237          }
238          joinPool(se);
# Line 248 | Line 248 | public class ScheduledExecutorTest exten
248              se.schedule(new NoOpCallable(),
249                          MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
250              shouldThrow();
251 <        } catch (RejectedExecutionException success){
251 >        } catch (RejectedExecutionException success) {
252          } catch (SecurityException ok) {
253          }
254           joinPool(se);
# Line 264 | Line 264 | public class ScheduledExecutorTest exten
264              se.scheduleAtFixedRate(new NoOpRunnable(),
265                                     MEDIUM_DELAY_MS, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
266              shouldThrow();
267 <        } catch (RejectedExecutionException success){
267 >        } catch (RejectedExecutionException success) {
268          } catch (SecurityException ok) {
269          }
270          joinPool(se);
# Line 280 | Line 280 | public class ScheduledExecutorTest exten
280              se.scheduleWithFixedDelay(new NoOpRunnable(),
281                                        MEDIUM_DELAY_MS, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
282              shouldThrow();
283 <        } catch (RejectedExecutionException success){
283 >        } catch (RejectedExecutionException success) {
284          } catch (SecurityException ok) {
285          }
286          joinPool(se);
# Line 296 | Line 296 | public class ScheduledExecutorTest exten
296          p2.execute(new SmallRunnable());
297          try {
298              Thread.sleep(SHORT_DELAY_MS);
299 <        } catch (Exception e){
299 >        } catch (Exception e) {
300              unexpectedException();
301          }
302          assertEquals(1, p2.getActiveCount());
# Line 313 | Line 313 | public class ScheduledExecutorTest exten
313          p2.execute(new SmallRunnable());
314          try {
315              Thread.sleep(MEDIUM_DELAY_MS);
316 <        } catch (Exception e){
316 >        } catch (Exception e) {
317              unexpectedException();
318          }
319          assertEquals(1, p2.getCompletedTaskCount());
# Line 340 | Line 340 | public class ScheduledExecutorTest exten
340          p2.execute(new SmallRunnable());
341          try {
342              Thread.sleep(SHORT_DELAY_MS);
343 <        } catch (Exception e){
343 >        } catch (Exception e) {
344              unexpectedException();
345          }
346          assertEquals(2, p2.getLargestPoolSize());
# Line 370 | Line 370 | public class ScheduledExecutorTest exten
370              p1.execute(new SmallRunnable());
371          try {
372              Thread.sleep(SHORT_DELAY_MS);
373 <        } catch (Exception e){
373 >        } catch (Exception e) {
374              unexpectedException();
375          }
376          assertEquals(5, p1.getTaskCount());
# Line 441 | Line 441 | public class ScheduledExecutorTest exten
441          try {
442              assertTrue(p1.awaitTermination(LONG_DELAY_MS, TimeUnit.MILLISECONDS));
443              assertTrue(p1.isTerminated());
444 <        } catch (Exception e){
444 >        } catch (Exception e) {
445              unexpectedException();
446          }
447      }
# Line 462 | Line 462 | public class ScheduledExecutorTest exten
462              assertTrue(p1.awaitTermination(LONG_DELAY_MS, TimeUnit.MILLISECONDS));
463              assertTrue(p1.isTerminated());
464              assertFalse(p1.isTerminating());
465 <        } catch (Exception e){
465 >        } catch (Exception e) {
466              unexpectedException();
467          }
468      }
# Line 473 | Line 473 | public class ScheduledExecutorTest exten
473      public void testGetQueue() {
474          ScheduledThreadPoolExecutor p1 = new ScheduledThreadPoolExecutor(1);
475          ScheduledFuture[] tasks = new ScheduledFuture[5];
476 <        for (int i = 0; i < 5; i++){
476 >        for (int i = 0; i < 5; i++) {
477              tasks[i] = p1.schedule(new SmallPossiblyInterruptedRunnable(), 1, TimeUnit.MILLISECONDS);
478          }
479          try {
# Line 494 | Line 494 | public class ScheduledExecutorTest exten
494      public void testRemove() {
495          ScheduledThreadPoolExecutor p1 = new ScheduledThreadPoolExecutor(1);
496          ScheduledFuture[] tasks = new ScheduledFuture[5];
497 <        for (int i = 0; i < 5; i++){
497 >        for (int i = 0; i < 5; i++) {
498              tasks[i] = p1.schedule(new SmallPossiblyInterruptedRunnable(), 1, TimeUnit.MILLISECONDS);
499          }
500          try {
# Line 522 | Line 522 | public class ScheduledExecutorTest exten
522      public void testPurge() {
523          ScheduledThreadPoolExecutor p1 = new ScheduledThreadPoolExecutor(1);
524          ScheduledFuture[] tasks = new ScheduledFuture[5];
525 <        for (int i = 0; i < 5; i++){
525 >        for (int i = 0; i < 5; i++) {
526              tasks[i] = p1.schedule(new SmallPossiblyInterruptedRunnable(), SHORT_DELAY_MS, TimeUnit.MILLISECONDS);
527          }
528          try {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines