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

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

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

revision 1.67, Sun May 24 01:23:17 2015 UTC revision 1.68, Sun Oct 4 18:49:02 2015 UTC
# Line 788  Line 788 
788          final ArrayBlockingQueue q = new ArrayBlockingQueue(2);          final ArrayBlockingQueue q = new ArrayBlockingQueue(2);
789          q.add(one);          q.add(one);
790          q.add(two);          q.add(two);
         ExecutorService executor = Executors.newFixedThreadPool(2);  
791          final CheckedBarrier threadsStarted = new CheckedBarrier(2);          final CheckedBarrier threadsStarted = new CheckedBarrier(2);
792            final ExecutorService executor = Executors.newFixedThreadPool(2);
793            try (PoolCleaner cleaner = cleaner(executor)) {
794          executor.execute(new CheckedRunnable() {          executor.execute(new CheckedRunnable() {
795              public void realRun() throws InterruptedException {              public void realRun() throws InterruptedException {
796                  assertFalse(q.offer(three));                  assertFalse(q.offer(three));
# Line 804  Line 805 
805                  assertEquals(0, q.remainingCapacity());                  assertEquals(0, q.remainingCapacity());
806                  assertSame(one, q.take());                  assertSame(one, q.take());
807              }});              }});
808            }
         joinPool(executor);  
809      }      }
810    
811      /**      /**
# Line 814  Line 814 
814      public void testPollInExecutor() {      public void testPollInExecutor() {
815          final ArrayBlockingQueue q = new ArrayBlockingQueue(2);          final ArrayBlockingQueue q = new ArrayBlockingQueue(2);
816          final CheckedBarrier threadsStarted = new CheckedBarrier(2);          final CheckedBarrier threadsStarted = new CheckedBarrier(2);
817          ExecutorService executor = Executors.newFixedThreadPool(2);          final ExecutorService executor = Executors.newFixedThreadPool(2);
818            try (PoolCleaner cleaner = cleaner(executor)) {
819          executor.execute(new CheckedRunnable() {          executor.execute(new CheckedRunnable() {
820              public void realRun() throws InterruptedException {              public void realRun() throws InterruptedException {
821                  assertNull(q.poll());                  assertNull(q.poll());
# Line 828  Line 829 
829                  threadsStarted.await();                  threadsStarted.await();
830                  q.put(one);                  q.put(one);
831              }});              }});
832            }
         joinPool(executor);  
833      }      }
834    
835      /**      /**

Legend:
Removed from v.1.67  
changed lines
  Added in v.1.68

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8