[cvs] / jsr166 / src / test / tck / FutureTaskTest.java Repository:
ViewVC logotype

Diff of /jsr166/src/test/tck/FutureTaskTest.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.35, Mon Jan 14 21:54:42 2013 UTC revision 1.36, Sun Apr 21 06:26:43 2013 UTC
# Line 590  Line 590 
590       * CancellationException       * CancellationException
591       */       */
592      public void testTimedGet_Cancellation() {      public void testTimedGet_Cancellation() {
593          for (final boolean mayInterruptIfRunning :          testTimedGet_Cancellation(false);
594                   new boolean[] { true, false }) {      }
595        public void testTimedGet_Cancellation_interrupt() {
596            testTimedGet_Cancellation(true);
597        }
598        public void testTimedGet_Cancellation(final boolean mayInterruptIfRunning) {
599              final CountDownLatch pleaseCancel = new CountDownLatch(3);              final CountDownLatch pleaseCancel = new CountDownLatch(3);
600              final CountDownLatch cancelled = new CountDownLatch(1);              final CountDownLatch cancelled = new CountDownLatch(1);
601              final PublicFutureTask task =          final Callable<Object> callable =
602                  new PublicFutureTask(new CheckedCallable<Object>() {              new CheckedCallable<Object>() {
603                      public Object realCall() throws InterruptedException {                      public Object realCall() throws InterruptedException {
604                          pleaseCancel.countDown();                          pleaseCancel.countDown();
605                          if (mayInterruptIfRunning) {                          if (mayInterruptIfRunning) {
# Line 606  Line 610 
610                              await(cancelled);                              await(cancelled);
611                          }                          }
612                          return two;                          return two;
613                      }});              }};
614            final PublicFutureTask task = new PublicFutureTask(callable);
615    
616              Thread t1 = new ThreadShouldThrow(CancellationException.class) {              Thread t1 = new ThreadShouldThrow(CancellationException.class) {
617                  public void realRun() throws Exception {                  public void realRun() throws Exception {
# Line 635  Line 640 
640              tryToConfuseDoneTask(task);              tryToConfuseDoneTask(task);
641              checkCancelled(task);              checkCancelled(task);
642          }          }
     }  
643    
644      /**      /**
645       * A runtime exception in task causes get to throw ExecutionException       * A runtime exception in task causes get to throw ExecutionException

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.36

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8