geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From genspr...@apache.org
Subject svn commit: r813266 - in /geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat: TomcatServerGBean.java connector/ConnectorGBean.java model/ServiceType.java
Date Thu, 10 Sep 2009 07:03:52 GMT
Author: genspring
Date: Thu Sep 10 07:03:51 2009
New Revision: 813266

URL: http://svn.apache.org/viewvc?rev=813266&view=rev
Log:
GERONIMO-4856 Some abnormal conditions with Tomcat NIO HTTPS Connector

Modified:
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerGBean.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorGBean.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ServiceType.java

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerGBean.java?rev=813266&r1=813265&r2=813266&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerGBean.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerGBean.java
Thu Sep 10 07:03:51 2009
@@ -40,6 +40,7 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
+import org.apache.catalina.Executor;
 import org.apache.catalina.Lifecycle;
 import org.apache.catalina.LifecycleListener;
 import org.apache.catalina.Server;
@@ -70,6 +71,7 @@
     private static final String DEFAULT_CATALINA_HOME = "var/catalina";
     public static final Map<Connector,String> ConnectorName=new HashMap<Connector,String>();
     public static final List<LifecycleListener> LifecycleListeners=new ArrayList<LifecycleListener>();
+    public static final Map<String,Executor> executors=new HashMap<String,Executor>();
     static {
         try {
             SERVER_CONTEXT = JAXBContext.newInstance(ServerType.class);

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorGBean.java?rev=813266&r1=813265&r2=813266&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorGBean.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorGBean.java
Thu Sep 10 07:03:51 2009
@@ -23,6 +23,7 @@
 
 import javax.management.j2ee.statistics.Stats;
 
+import org.apache.catalina.Executor;
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleListener;
 import org.apache.catalina.connector.Connector;
@@ -36,6 +37,7 @@
 import org.apache.geronimo.tomcat.ObjectRetriever;
 import org.apache.geronimo.tomcat.TomcatContainer;
 import org.apache.geronimo.tomcat.TomcatServerGBean;
+import org.apache.tomcat.util.IntrospectionUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -50,7 +52,7 @@
     
     protected final Connector connector;
 
-    private final TomcatContainer container;
+    protected final TomcatContainer container;
 
     private String name;
     
@@ -110,7 +112,64 @@
     }
 
     public void doStart() throws LifecycleException {
+        
+        String executorName=null;
+        Executor executor=null;
+        
+        if (this.connector.getAttribute("executor") != null) {
+            
+            Object value = connector.getAttribute("executor");
+            if (value == null)
+                executorName=null;
+            
+            if (value instanceof String)
+                executorName= (String)value;
+            
+            if(value instanceof Executor){
+                executorName= ((Executor) value).getName();
+            }
+            
+            executor = TomcatServerGBean.executors.get(executorName);
+            
+            if (executor == null) { 
+               
+                log.warn("No executor found with name:" + executorName+", trying to get default
executor with name 'DefaultThreadPool'");
+                executor = TomcatServerGBean.executors.get("DefaultThreadPool");   
+            }  
+            
+            
+        } else {
+            
+            executor = TomcatServerGBean.executors.get("DefaultThreadPool");  
+            
+            if (executor == null) {
+                
+                log.warn("No executor found in service with name: DefaultThreadPool");
+                
+            } 
+        }
+        
+        
+        if (executor != null)
+
+        {
+            log.info("executor"+executor.getName()+" found, set it to connector:"+this.getName()
);     
+
+            try {
+
+                IntrospectionUtils.callMethod1(this.connector.getProtocolHandler(), 
+                                                "setExecutor", 
+                                                executor,
+                                                java.util.concurrent.Executor.class.getName(),
+                                                connector.getClass().getClassLoader());
+            } catch (Exception e) {
+                
+                log.info("connector:"+this.getName()+"does not support executor set, do nothing");
+            }
+        }
+        
         container.addConnector(this.connector);
+        
         log.debug("{} connector started", name);
 
     }

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ServiceType.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ServiceType.java?rev=813266&r1=813265&r2=813266&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ServiceType.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ServiceType.java
Thu Sep 10 07:03:51 2009
@@ -31,6 +31,7 @@
 import org.apache.xbean.recipe.ObjectRecipe;
 import org.apache.xbean.recipe.Option;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.tomcat.TomcatServerGBean;
 
 
 /**
@@ -271,6 +272,7 @@
         for (ExecutorType executorType: getExecutor()) {
             Executor executor = executorType.getExecutor(cl, kernel);
             service.addExecutor(executor);
+            TomcatServerGBean.executors.put(executor.getName(), executor);
         }
         for (ConnectorType connectorType: getConnector()) {
             Connector connector = connectorType.getConnector(cl, service);



Mime
View raw message