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

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

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

revision 1.40, Sun Oct 4 18:18:48 2015 UTC revision 1.41, Mon Oct 5 22:54:45 2015 UTC
# Line 194  Line 194 
194          final CountDownLatch quittingTime = new CountDownLatch(1);          final CountDownLatch quittingTime = new CountDownLatch(1);
195          final Callable<Void> awaiter = new CheckedCallable<Void>() {          final Callable<Void> awaiter = new CheckedCallable<Void>() {
196              public Void realCall() throws InterruptedException {              public Void realCall() throws InterruptedException {
197                  quittingTime.await();                  assertTrue(quittingTime.await(2*LONG_DELAY_MS, MILLISECONDS));
198                  return null;                  return null;
199              }};              }};
200          final ExecutorService p          final ExecutorService p
201              = new ThreadPoolExecutor(1,1,60, TimeUnit.SECONDS,              = new ThreadPoolExecutor(1,1,60, TimeUnit.SECONDS,
202                                       new ArrayBlockingQueue<Runnable>(10));                                       new ArrayBlockingQueue<Runnable>(10));
203          try (PoolCleaner cleaner = cleaner(p)) {          try (PoolCleaner cleaner = cleaner(p, quittingTime)) {
204              Thread t = new Thread(new CheckedInterruptedRunnable() {              Thread t = newStartedThread(new CheckedInterruptedRunnable() {
205                  public void realRun() throws Exception {                  public void realRun() throws Exception {
206                      Future<Void> future = p.submit(awaiter);                      Future<Void> future = p.submit(awaiter);
207                      submitted.countDown();                      submitted.countDown();
208                      future.get();                      future.get();
209                  }});                  }});
210              t.start();  
211              submitted.await();              await(submitted);
212              t.interrupt();              t.interrupt();
213              t.join();              awaitTermination(t);
             quittingTime.countDown();  
214          }          }
215      }      }
216    

Legend:
Removed from v.1.40  
changed lines
  Added in v.1.41

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8