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

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

# Line 87 | Line 87 | public class ScheduledExecutorSubclassTe
87              try { p1.shutdown(); } catch (SecurityException ok) { return; }
88              try {
89                  Thread.sleep(MEDIUM_DELAY_MS);
90 <            } catch (InterruptedException e){
90 >            } catch (InterruptedException e) {
91                  unexpectedException();
92              }
93              assertTrue(runnable.done);
94              try { p1.shutdown(); } catch (SecurityException ok) { return; }
95              joinPool(p1);
96          }
97 <        catch (Exception e){
97 >        catch (Exception e) {
98              unexpectedException();
99          }
100  
# Line 115 | Line 115 | public class ScheduledExecutorSubclassTe
115              assertEquals(Boolean.TRUE, f.get());
116              try { p1.shutdown(); } catch (SecurityException ok) { return; }
117              joinPool(p1);
118 <        } catch (RejectedExecutionException e){}
119 <        catch (Exception e){
118 >        } catch (RejectedExecutionException e) {}
119 >        catch (Exception e) {
120              e.printStackTrace();
121              unexpectedException();
122          }
# Line 136 | Line 136 | public class ScheduledExecutorSubclassTe
136              assertTrue(runnable.done);
137              try { p1.shutdown(); } catch (SecurityException ok) { return; }
138              joinPool(p1);
139 <        } catch (Exception e){
139 >        } catch (Exception e) {
140              unexpectedException();
141          }
142      }
# Line 154 | Line 154 | public class ScheduledExecutorSubclassTe
154              assertTrue(runnable.done);
155              h.cancel(true);
156              joinPool(p1);
157 <        } catch (Exception e){
157 >        } catch (Exception e) {
158              unexpectedException();
159          }
160      }
# Line 177 | Line 177 | public class ScheduledExecutorSubclassTe
177              assertTrue(runnable.done);
178              h.cancel(true);
179              joinPool(p1);
180 <        } catch (Exception e){
180 >        } catch (Exception e) {
181              unexpectedException();
182          }
183      }
# Line 199 | Line 199 | public class ScheduledExecutorSubclassTe
199              assertTrue(c >= SMALL_DELAY_MS / SHORT_DELAY_MS);
200              assertTrue(c <= SMALL_DELAY_MS + SHORT_DELAY_MS);
201              joinPool(p1);
202 <        } catch (Exception e){
202 >        } catch (Exception e) {
203              unexpectedException();
204          }
205      }
# Line 219 | Line 219 | public class ScheduledExecutorSubclassTe
219              assertTrue(c >= SMALL_DELAY_MS / SHORT_DELAY_MS);
220              assertTrue(c <= SMALL_DELAY_MS + SHORT_DELAY_MS);
221              joinPool(p1);
222 <        } catch (Exception e){
222 >        } catch (Exception e) {
223              unexpectedException();
224          }
225      }
# Line 234 | Line 234 | public class ScheduledExecutorSubclassTe
234              se = new CustomExecutor(1);
235              se.execute(null);
236              shouldThrow();
237 <        } catch (NullPointerException success){}
238 <        catch (Exception e){
237 >        } catch (NullPointerException success) {}
238 >        catch (Exception e) {
239              unexpectedException();
240          }
241  
# Line 251 | Line 251 | public class ScheduledExecutorSubclassTe
251              TrackedCallable callable = null;
252              Future f = se.schedule(callable, SHORT_DELAY_MS, TimeUnit.MILLISECONDS);
253              shouldThrow();
254 <        } catch (NullPointerException success){}
255 <        catch (Exception e){
254 >        } catch (NullPointerException success) {}
255 >        catch (Exception e) {
256              unexpectedException();
257          }
258          joinPool(se);
# Line 268 | Line 268 | public class ScheduledExecutorSubclassTe
268              se.schedule(new NoOpRunnable(),
269                          MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
270              shouldThrow();
271 <        } catch (RejectedExecutionException success){
271 >        } catch (RejectedExecutionException success) {
272          } catch (SecurityException ok) {
273          }
274  
# Line 286 | Line 286 | public class ScheduledExecutorSubclassTe
286              se.schedule(new NoOpCallable(),
287                          MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
288              shouldThrow();
289 <        } catch (RejectedExecutionException success){
289 >        } catch (RejectedExecutionException success) {
290          } catch (SecurityException ok) {
291          }
292          joinPool(se);
# Line 302 | Line 302 | public class ScheduledExecutorSubclassTe
302              se.schedule(new NoOpCallable(),
303                          MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
304              shouldThrow();
305 <        } catch (RejectedExecutionException success){
305 >        } catch (RejectedExecutionException success) {
306          } catch (SecurityException ok) {
307          }
308           joinPool(se);
# Line 318 | Line 318 | public class ScheduledExecutorSubclassTe
318              se.scheduleAtFixedRate(new NoOpRunnable(),
319                                     MEDIUM_DELAY_MS, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
320              shouldThrow();
321 <        } catch (RejectedExecutionException success){
321 >        } catch (RejectedExecutionException success) {
322          } catch (SecurityException ok) {
323          }
324          joinPool(se);
# Line 334 | Line 334 | public class ScheduledExecutorSubclassTe
334              se.scheduleWithFixedDelay(new NoOpRunnable(),
335                                        MEDIUM_DELAY_MS, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS);
336              shouldThrow();
337 <        } catch (RejectedExecutionException success){
337 >        } catch (RejectedExecutionException success) {
338          } catch (SecurityException ok) {
339          }
340          joinPool(se);
# Line 350 | Line 350 | public class ScheduledExecutorSubclassTe
350          p2.execute(new SmallRunnable());
351          try {
352              Thread.sleep(SHORT_DELAY_MS);
353 <        } catch (Exception e){
353 >        } catch (Exception e) {
354              unexpectedException();
355          }
356          assertEquals(1, p2.getActiveCount());
# Line 367 | Line 367 | public class ScheduledExecutorSubclassTe
367          p2.execute(new SmallRunnable());
368          try {
369              Thread.sleep(MEDIUM_DELAY_MS);
370 <        } catch (Exception e){
370 >        } catch (Exception e) {
371              unexpectedException();
372          }
373          assertEquals(1, p2.getCompletedTaskCount());
# Line 394 | Line 394 | public class ScheduledExecutorSubclassTe
394          p2.execute(new SmallRunnable());
395          try {
396              Thread.sleep(SHORT_DELAY_MS);
397 <        } catch (Exception e){
397 >        } catch (Exception e) {
398              unexpectedException();
399          }
400          assertEquals(2, p2.getLargestPoolSize());
# Line 424 | Line 424 | public class ScheduledExecutorSubclassTe
424              p1.execute(new SmallRunnable());
425          try {
426              Thread.sleep(SHORT_DELAY_MS);
427 <        } catch (Exception e){
427 >        } catch (Exception e) {
428              unexpectedException();
429          }
430          assertEquals(5, p1.getTaskCount());
# Line 495 | Line 495 | public class ScheduledExecutorSubclassTe
495          try {
496              assertTrue(p1.awaitTermination(LONG_DELAY_MS, TimeUnit.MILLISECONDS));
497              assertTrue(p1.isTerminated());
498 <        } catch (Exception e){
498 >        } catch (Exception e) {
499              unexpectedException();
500          }
501      }
# Line 516 | Line 516 | public class ScheduledExecutorSubclassTe
516              assertTrue(p1.awaitTermination(LONG_DELAY_MS, TimeUnit.MILLISECONDS));
517              assertTrue(p1.isTerminated());
518              assertFalse(p1.isTerminating());
519 <        } catch (Exception e){
519 >        } catch (Exception e) {
520              unexpectedException();
521          }
522      }
# Line 527 | Line 527 | public class ScheduledExecutorSubclassTe
527      public void testGetQueue() {
528          CustomExecutor p1 = new CustomExecutor(1);
529          ScheduledFuture[] tasks = new ScheduledFuture[5];
530 <        for (int i = 0; i < 5; i++){
530 >        for (int i = 0; i < 5; i++) {
531              tasks[i] = p1.schedule(new SmallPossiblyInterruptedRunnable(), 1, TimeUnit.MILLISECONDS);
532          }
533          try {
# Line 548 | Line 548 | public class ScheduledExecutorSubclassTe
548      public void testRemove() {
549          CustomExecutor p1 = new CustomExecutor(1);
550          ScheduledFuture[] tasks = new ScheduledFuture[5];
551 <        for (int i = 0; i < 5; i++){
551 >        for (int i = 0; i < 5; i++) {
552              tasks[i] = p1.schedule(new SmallPossiblyInterruptedRunnable(), 1, TimeUnit.MILLISECONDS);
553          }
554          try {
# Line 576 | Line 576 | public class ScheduledExecutorSubclassTe
576      public void testPurge() {
577          CustomExecutor p1 = new CustomExecutor(1);
578          ScheduledFuture[] tasks = new ScheduledFuture[5];
579 <        for (int i = 0; i < 5; i++){
579 >        for (int i = 0; i < 5; i++) {
580              tasks[i] = p1.schedule(new SmallPossiblyInterruptedRunnable(), SHORT_DELAY_MS, TimeUnit.MILLISECONDS);
581          }
582          try {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines