[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.27, Sat Oct 9 19:30:34 2010 UTC revision 1.28, Mon Oct 11 07:21:32 2010 UTC
# Line 170  Line 170 
170      }      }
171    
172      /**      /**
      * submit(runnable) throws RejectedExecutionException if  
      * executor is saturated.  
      */  
     public void testExecute1() {  
         ThreadPoolExecutor p =  
             new ThreadPoolExecutor(1, 1,  
                                    60, TimeUnit.SECONDS,  
                                    new ArrayBlockingQueue<Runnable>(1));  
         try {  
             for (int i = 0; i < 2; ++i)  
                 p.submit(new MediumRunnable());  
             for (int i = 0; i < 2; ++i) {  
                 try {  
                     p.submit(new MediumRunnable());  
                     shouldThrow();  
                 } catch (RejectedExecutionException success) {}  
             }  
         } finally {  
             joinPool(p);  
         }  
     }  
   
     /**  
      * submit(callable) throws RejectedExecutionException  
      * if executor is saturated.  
      */  
     public void testExecute2() {  
         ThreadPoolExecutor p =  
             new ThreadPoolExecutor(1, 1,  
                                    60, TimeUnit.SECONDS,  
                                    new ArrayBlockingQueue<Runnable>(1));  
         try {  
             for (int i = 0; i < 2; ++i)  
                 p.submit(new MediumRunnable());  
             for (int i = 0; i < 2; ++i) {  
                 try {  
                     p.submit(new SmallCallable());  
                     shouldThrow();  
                 } catch (RejectedExecutionException success) {}  
             }  
         } finally {  
             joinPool(p);  
         }  
     }  
   
   
     /**  
173       * submit(callable).get() throws InterruptedException if interrupted       * submit(callable).get() throws InterruptedException if interrupted
174       */       */
175      public void testInterruptedSubmit() throws InterruptedException {      public void testInterruptedSubmit() throws InterruptedException {
# Line 248  Line 201 
201      }      }
202    
203      /**      /**
      * get of submitted callable throws InterruptedException if callable  
      * interrupted  
      */  
     public void testSubmitIE() throws InterruptedException {  
         final ThreadPoolExecutor p =  
             new ThreadPoolExecutor(1, 1,  
                                    60, TimeUnit.SECONDS,  
                                    new ArrayBlockingQueue<Runnable>(10));  
   
         Thread t = new Thread(new CheckedInterruptedRunnable() {  
             public void realRun() throws Exception {  
                 p.submit(new SmallCallable()).get();  
             }});  
   
         t.start();  
         Thread.sleep(SHORT_DELAY_MS);  
         t.interrupt();  
         t.join();  
         joinPool(p);  
     }  
   
     /**  
204       * get of submit(callable) throws ExecutionException if callable       * get of submit(callable) throws ExecutionException if callable
205       * throws exception       * throws exception
206       */       */
# Line 294  Line 225 
225      /**      /**
226       * invokeAny(null) throws NPE       * invokeAny(null) throws NPE
227       */       */
228      public void testInvokeAny1()      public void testInvokeAny1() throws Exception {
         throws InterruptedException, ExecutionException {  
229          ExecutorService e = new DirectExecutorService();          ExecutorService e = new DirectExecutorService();
230          try {          try {
231              e.invokeAny(null);              e.invokeAny(null);
# Line 309  Line 239 
239      /**      /**
240       * invokeAny(empty collection) throws IAE       * invokeAny(empty collection) throws IAE
241       */       */
242      public void testInvokeAny2()      public void testInvokeAny2() throws Exception {
         throws InterruptedException, ExecutionException {  
243          ExecutorService e = new DirectExecutorService();          ExecutorService e = new DirectExecutorService();
244          try {          try {
245              e.invokeAny(new ArrayList<Callable<String>>());              e.invokeAny(new ArrayList<Callable<String>>());

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8