View Javadoc

1   /*$Id: CeaThreadPool.java,v 1.3 2004/09/22 10:52:50 pah Exp $
2    * Created on 14-Sep-2004
3    *
4    * Copyright (C) AstroGrid. All rights reserved.
5    *
6    * This software is published under the terms of the AstroGrid 
7    * Software License version 1.2, a copy of which has been included 
8    * with this distribution in the LICENSE.txt file.  
9    *
10  **/
11  package org.astrogrid.applications.manager;
12  
13  import org.astrogrid.component.descriptor.ComponentDescriptor;
14  
15  import org.picocontainer.Startable;
16  
17  import junit.framework.Test;
18  
19  import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
20  import EDU.oswego.cs.dl.util.concurrent.PooledExecutor;
21  
22  /*** customization of the standard pooled executor - to fit in better with our component system, and to provide default configuration.
23   * default configuration is an unbounded queue, max of 100 worker threads, minimum of 4 concurrent threads.
24   * @author Noel Winstanley nw@jb.man.ac.uk 14-Sep-2004
25   *
26   */
27  public class CeaThreadPool extends PooledExecutor implements
28          ComponentDescriptor, Startable {
29  
30      /*** Construct a new CeaThreadPool
31       * 
32       */
33      public CeaThreadPool() {
34          super(new LinkedQueue(),100);
35          super.setMinimumPoolSize(4);
36      }
37  
38      /***
39       * @see org.astrogrid.component.descriptor.ComponentDescriptor#getName()
40       */
41      public String getName() {
42          return "CeaThreadPool";
43      }
44  
45      /***
46       * @see org.astrogrid.component.descriptor.ComponentDescriptor#getDescription()
47       */
48      public String getDescription() {
49          return "Current number of worker threads " + super.getPoolSize();
50      }
51  
52      /***
53       * @see org.astrogrid.component.descriptor.ComponentDescriptor#getInstallationTest()
54       */
55      public Test getInstallationTest() {
56          return null;
57      }
58  
59      /***
60       * @see org.picocontainer.Startable#start()
61       */
62      public void start() {
63      }
64  
65      /*** tell the threads in the pool to stop processing.
66       * @see org.picocontainer.Startable#stop()
67       */
68      public void stop() {
69          this.shutdownNow();
70      }
71  
72  
73  }
74  
75  
76  /* 
77  $Log: CeaThreadPool.java,v $
78  Revision 1.3  2004/09/22 10:52:50  pah
79  getting rid of some unused imports
80  
81  Revision 1.2  2004/09/17 01:21:49  nw
82  implemented execution controller that uses a threadpool
83  
84  Revision 1.1.2.1  2004/09/14 13:45:22  nw
85  implemented thread pooling
86   
87  */