cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From egl...@apache.org
Subject svn commit: r543509 - in /incubator/cxf/trunk/rt/transports/http-jetty/src/main: java/org/apache/cxf/transport/http_jetty/ java/org/apache/cxf/transport/http_jetty/spring/ resources/META-INF/
Date Fri, 01 Jun 2007 15:37:04 GMT
Author: eglynn
Date: Fri Jun  1 08:37:03 2007
New Revision: 543509

URL: http://svn.apache.org/viewvc?view=rev&rev=543509
Log:
Restored ability to configure Jetty thread pool thresholds (broken in the port to Jetty6).

Added:
    incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/spring/
    incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/spring/ListenerBeanDefinitionParser.java
  (with props)
    incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/spring/NamespaceHandler.java
  (with props)
    incubator/cxf/trunk/rt/transports/http-jetty/src/main/resources/META-INF/spring.handlers
  (with props)
Modified:
    incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java

Modified: incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java?view=diff&rev=543509&r1=543508&r2=543509
==============================================================================
--- incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
(original)
+++ incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
Fri Jun  1 08:37:03 2007
@@ -35,6 +35,7 @@
 import org.mortbay.jetty.Server;
 import org.mortbay.jetty.handler.ContextHandler;
 import org.mortbay.jetty.handler.ContextHandlerCollection;
+import org.mortbay.thread.BoundedThreadPool;
 
 
 
@@ -141,12 +142,6 @@
             connector = connectorFactory.createConnector(port);
             //REVISITION for setup the connector's threadPool
             /*
-            if (getListener().isSetMinThreads()) {
-                listener.setMinThreads(getListener().getMinThreads());
-            }
-            if (getListener().isSetMaxThreads()) {
-                listener.setMaxThreads(getListener().getMaxThreads());            
-            }
             if (getListener().isSetMaxIdleTimeMs()) {
                 listener.setMaxIdleTimeMs(getListener().getMaxIdleTimeMs().intValue());
             }
@@ -161,6 +156,16 @@
             server.addHandler(contexts);
             try {
                 server.start();
+                if (connector.getThreadPool() instanceof BoundedThreadPool
+                    && isSetListener()) {
+                    BoundedThreadPool pool = (BoundedThreadPool)connector.getThreadPool();
+                    if (getListener().isSetMinThreads()) {
+                        pool.setMinThreads(getListener().getMinThreads());
+                    }
+                    if (getListener().isSetMaxThreads()) {
+                        pool.setMaxThreads(getListener().getMaxThreads());
+                    }
+                }
             } catch (Exception e) {
                 e.printStackTrace();
                 //problem starting server

Added: incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/spring/ListenerBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/spring/ListenerBeanDefinitionParser.java?view=auto&rev=543509
==============================================================================
--- incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/spring/ListenerBeanDefinitionParser.java
(added)
+++ incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/spring/ListenerBeanDefinitionParser.java
Fri Jun  1 08:37:03 2007
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.transport.http_jetty.spring;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.configuration.spring.AbstractBeanDefinitionParser;
+import org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine;
+
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+
+public class ListenerBeanDefinitionParser  extends AbstractBeanDefinitionParser {
+     
+    private static final String HTTP_NS = "http://cxf.apache.org/transports/http/configuration";
+    
+    @Override
+    protected Class getBeanClass(Element arg0) {
+        return JettyHTTPServerEngine.class;
+    }
+    
+    @Override
+    public void doParse(Element element, BeanDefinitionBuilder bean) {
+        bean.setAbstract(true);
+        mapElementToJaxbProperty(element, bean, new QName(HTTP_NS, "listener"), "listener");
+    }
+
+    @Override
+    protected String getJaxbPackage() {
+        return "org.apache.cxf.transports.http.configuration";
+    }
+}

Propchange: incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/spring/ListenerBeanDefinitionParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/spring/NamespaceHandler.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/spring/NamespaceHandler.java?view=auto&rev=543509
==============================================================================
--- incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/spring/NamespaceHandler.java
(added)
+++ incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/spring/NamespaceHandler.java
Fri Jun  1 08:37:03 2007
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.transport.http_jetty.spring;
+
+import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
+
+public class NamespaceHandler extends NamespaceHandlerSupport {
+    public void init() {
+        registerBeanDefinitionParser("listener", 
+                                     new ListenerBeanDefinitionParser());        
+    }
+}

Propchange: incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/spring/NamespaceHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cxf/trunk/rt/transports/http-jetty/src/main/resources/META-INF/spring.handlers
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/main/resources/META-INF/spring.handlers?view=auto&rev=543509
==============================================================================
--- incubator/cxf/trunk/rt/transports/http-jetty/src/main/resources/META-INF/spring.handlers
(added)
+++ incubator/cxf/trunk/rt/transports/http-jetty/src/main/resources/META-INF/spring.handlers
Fri Jun  1 08:37:03 2007
@@ -0,0 +1 @@
+http\://cxf.apache.org/transport/http/listener=org.apache.cxf.transport.http_jetty.spring.NamespaceHandler

Propchange: incubator/cxf/trunk/rt/transports/http-jetty/src/main/resources/META-INF/spring.handlers
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message