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

Comparing jsr166/src/test/tck/ThreadPoolExecutorTest.java (file contents):
Revision 1.1 by dl, Sun Aug 31 19:24:56 2003 UTC vs.
Revision 1.2 by dl, Sun Sep 7 20:39:11 2003 UTC

# Line 56 | Line 56 | public class ThreadPoolExecutorTest exte
56                      public void run(){
57                          try{
58                              Thread.sleep(SHORT_DELAY_MS);
59 <                        }catch(InterruptedException e){
59 >                        } catch(InterruptedException e){
60                              fail("unexpected exception");
61                          }
62                      }
63                  });
64              Thread.sleep(SHORT_DELAY_MS * 2);
65 <        }catch(InterruptedException e){
65 >        } catch(InterruptedException e){
66              fail("unexpected exception");
67          } finally {
68              one.shutdown();
# Line 77 | Line 77 | public class ThreadPoolExecutorTest exte
77          try {
78              assertEquals(0, two.getActiveCount());
79              two.execute(newRunnable());
80 <            try{Thread.sleep(10);}catch(Exception e){}
80 >            try{Thread.sleep(10);} catch(Exception e){}
81              assertEquals(1, two.getActiveCount());
82          } finally {
83              two.shutdown();
# Line 92 | Line 92 | public class ThreadPoolExecutorTest exte
92          try {
93              assertEquals(0, two.getCompletedTaskCount());
94              two.execute(newRunnable());
95 <            try{Thread.sleep(2000);}catch(Exception e){}
95 >            try{Thread.sleep(2000);} catch(Exception e){}
96              assertEquals(1, two.getCompletedTaskCount());
97          } finally {
98              two.shutdown();
# Line 174 | Line 174 | public class ThreadPoolExecutorTest exte
174              assertEquals(0, one.getTaskCount());
175              for(int i = 0; i < 5; i++)
176                  one.execute(newRunnable());
177 <            try{Thread.sleep(SHORT_DELAY_MS);}catch(Exception e){}
177 >            try{Thread.sleep(SHORT_DELAY_MS);} catch(Exception e){}
178              assertEquals(5, one.getTaskCount());
179          } finally {
180              one.shutdown();
# Line 212 | Line 212 | public class ThreadPoolExecutorTest exte
212          boolean flag = false;
213          try{
214              flag = one.awaitTermination(10, TimeUnit.SECONDS);
215 <        }catch(Exception e){}  
215 >        } catch(Exception e){}  
216          assertTrue(one.isTerminated());
217          if(!flag)
218              fail("ThreadPoolExecutor - thread pool did not terminate within suitable timeframe");
# Line 327 | Line 327 | public class ThreadPoolExecutorTest exte
327          try{
328              new ThreadPoolExecutor(-1,1,100L,TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(10),new testThread());
329              fail("ThreadPoolExecutor constructor should throw an IllegalArgumentException");            
330 <        }catch (IllegalArgumentException i6){}
330 >        } catch (IllegalArgumentException i6){}
331      }
332      
333      //---- Tests if maximumPoolSize is less than zero
# Line 535 | Line 535 | public class ThreadPoolExecutorTest exte
535          ThreadPoolExecutor tpe = null;
536          try{
537              tpe = new ThreadPoolExecutor(1,1,100,TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(1));
538 <        }catch(Exception e){}
538 >        } catch(Exception e){}
539          tpe.shutdown();
540          try{
541              tpe.execute(new Runnable(){
542                      public void run(){
543                          try{
544                              Thread.sleep(1000);
545 <                        }catch(InterruptedException e){}
545 >                        } catch(InterruptedException e){}
546                      }
547                  });
548              fail("ThreadPoolExecutor - void execute(Runnable) should throw RejectedExecutionException");
549 <        }catch(RejectedExecutionException sucess){}
549 >        } catch(RejectedExecutionException success){}
550          
551          
552      }
# Line 559 | Line 559 | public class ThreadPoolExecutorTest exte
559          ThreadPoolExecutor tpe = null;
560          try{
561              tpe = new ThreadPoolExecutor(1,2,100,TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10));
562 <        }catch(Exception e){}
562 >        } catch(Exception e){}
563          try{
564              tpe.setCorePoolSize(-1);
565              fail("ThreadPoolExecutor - void setCorePoolSize(int) should throw IllegalArgumentException");
566 <        }catch(IllegalArgumentException sucess){
566 >        } catch(IllegalArgumentException success){
567          } finally {
568              tpe.shutdown();
569          }
# Line 578 | Line 578 | public class ThreadPoolExecutorTest exte
578          ThreadPoolExecutor tpe = null;
579          try{
580              tpe = new ThreadPoolExecutor(2,3,100,TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10));
581 <        }catch(Exception e){}
581 >        } catch(Exception e){}
582          try{
583              tpe.setMaximumPoolSize(1);
584              fail("ThreadPoolExecutor - void setMaximumPoolSize(int) should throw IllegalArgumentException");
585 <        }catch(IllegalArgumentException sucess){
585 >        } catch(IllegalArgumentException success){
586          } finally {
587              tpe.shutdown();
588          }
# Line 596 | Line 596 | public class ThreadPoolExecutorTest exte
596          ThreadPoolExecutor tpe = null;
597          try{
598              tpe = new ThreadPoolExecutor(2,3,100,TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10));
599 <        }catch(Exception e){}
599 >        } catch(Exception e){}
600          try{
601              tpe.setMaximumPoolSize(-1);
602              fail("ThreadPoolExecutor - void setMaximumPoolSize(int) should throw IllegalArgumentException");
603 <        }catch(IllegalArgumentException sucess){
603 >        } catch(IllegalArgumentException success){
604          } finally {
605              tpe.shutdown();
606          }
# Line 615 | Line 615 | public class ThreadPoolExecutorTest exte
615          ThreadPoolExecutor tpe = null;
616          try{
617              tpe = new ThreadPoolExecutor(2,3,100,TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10));
618 <        }catch(Exception e){}
618 >        } catch(Exception e){}
619          
620          try{
621              tpe.setKeepAliveTime(-1,TimeUnit.MILLISECONDS);
622              fail("ThreadPoolExecutor - void setKeepAliveTime(long, TimeUnit) should throw IllegalArgumentException");
623 <        }catch(IllegalArgumentException sucess){
623 >        } catch(IllegalArgumentException success){
624          } finally {
625              tpe.shutdown();
626          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines