[jboss-cvs] JBossAS SVN: r61815 - trunk/tomcat/src/main/org/jboss/web/tomcat/service.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Mar 28 18:10:09 EDT 2007


Author: anil.saldhana at jboss.com
Date: 2007-03-28 18:10:09 -0400 (Wed, 28 Mar 2007)
New Revision: 61815

Modified:
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/StandardService.java
Log:
JBAS-4263:update the jboss version of StandardService with the executor related updates to the Catalina Service interface

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/StandardService.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/StandardService.java	2007-03-28 21:52:07 UTC (rev 61814)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/StandardService.java	2007-03-28 22:10:09 UTC (rev 61815)
@@ -23,12 +23,15 @@
 
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeSupport;
+import java.util.concurrent.CopyOnWriteArrayList;
+
 import javax.management.MBeanRegistration;
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
 import org.apache.catalina.Container;
 import org.apache.catalina.Engine;
+import org.apache.catalina.Executor;
 import org.apache.catalina.Lifecycle;
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleListener;
@@ -55,6 +58,7 @@
  *
  * @author Craig R. McClanahan
  * @author Scott.Stark at jboss.org
+ * @author Anil.Saldhana at redhat.com
  * @version $Revision: 56603 $
  */
 public class StandardService
@@ -129,6 +133,8 @@
     * The property change support for this component.
     */
    protected PropertyChangeSupport support = new PropertyChangeSupport(this);
+   
+   protected CopyOnWriteArrayList<Executor> executors = new CopyOnWriteArrayList<Executor>();
 
 
    // ------------------------------------------------------------- Properties
@@ -539,6 +545,11 @@
             }
          }
       }
+      
+      for ( int i=0; i<executors.size(); i++ ) 
+      {
+         executors.get(i).start();
+      }
 
       /* Start our defined Connectors second
       synchronized (connectors) {
@@ -621,6 +632,11 @@
                ((Lifecycle) connectors[i]).stop();
          }
       }
+      
+      for ( int i=0; i<executors.size(); i++ ) 
+      {
+         executors.get(i).stop();
+      }
 
       if (oname == controller)
       {
@@ -746,4 +762,57 @@
    {
    }
 
+
+   public void addExecutor(Executor ex)
+   { 
+      if (!executors.contains(ex)) 
+      {
+         executors.add(ex);
+         if (started)
+         try 
+         {
+            ex.start();
+         } 
+         catch (LifecycleException x) 
+         {
+            log.error("Executor.start", x);
+         }
+      } 
+   }
+
+
+   public Executor[] findExecutors()
+   { 
+      Executor[] arr = new Executor[executors.size()];
+      executors.toArray(arr);
+      return arr;
+   }
+
+
+   public Executor getExecutor(String name)
+   { 
+      for (int i = 0; i < executors.size(); i++) 
+      {
+         if (name.equals(executors.get(i).getName()))
+             return executors.get(i);
+      }
+      return null;
+   }
+
+
+   public void removeExecutor(Executor ex)
+   { 
+      if ( executors.remove(ex) && started ) 
+      {
+         try 
+         {
+             ex.stop();
+         } 
+         catch (LifecycleException e) 
+         {
+             log.error("Executor.stop", e);
+         }
+     }
+   }
+
 }




More information about the jboss-cvs-commits mailing list