camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1300806 - in /camel/branches/camel-2.9.x: ./ components/camel-cometd/src/main/java/org/apache/camel/component/cometd/ components/camel-cometd/src/test/java/org/apache/camel/component/cometd/ components/camel-solr/
Date Thu, 15 Mar 2012 03:10:54 GMT
Author: ningjiang
Date: Thu Mar 15 03:10:53 2012
New Revision: 1300806

URL: http://svn.apache.org/viewvc?rev=1300806&view=rev
Log:
Merged revisions 1300805 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r1300805 | ningjiang | 2012-03-15 11:00:40 +0800 (Thu, 15 Mar 2012) | 1 line
  
  CAMEL-5087 Let camel-cometd componnet supports multiple endpoints with different ports
........

Added:
    camel/branches/camel-2.9.x/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/MultipCometdProducerConsumerTest.java
      - copied unchanged from r1300805, camel/trunk/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/MultipCometdProducerConsumerTest.java
Modified:
    camel/branches/camel-2.9.x/   (props changed)
    camel/branches/camel-2.9.x/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdComponent.java
    camel/branches/camel-2.9.x/components/camel-solr/   (props changed)

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Mar 15 03:10:53 2012
@@ -1 +1 @@
-/camel/trunk:1243046,1243057,1243234,1244518,1244644,1244859,1244861,1244864,1244870,1244872,1245021,1291555,1291727,1291848,1291864,1292114,1292384,1292725,1292760,1292767,1293079,1293268,1293288,1293330,1293590,1293828,1293852,1293855,1294130,1294482,1294502,1294533,1294588,1294639,1294709,1294909,1294976,1295073,1295108,1295120,1296653,1296790,1298125,1298155,1298447,1298795,1298821,1298993,1299383,1299399,1300720-1300722
+/camel/trunk:1243046,1243057,1243234,1244518,1244644,1244859,1244861,1244864,1244870,1244872,1245021,1291555,1291727,1291848,1291864,1292114,1292384,1292725,1292760,1292767,1293079,1293268,1293288,1293330,1293590,1293828,1293852,1293855,1294130,1294482,1294502,1294533,1294588,1294639,1294709,1294909,1294976,1295073,1295108,1295120,1296653,1296790,1298125,1298155,1298447,1298795,1298821,1298993,1299383,1299399,1300720-1300722,1300805

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.9.x/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdComponent.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdComponent.java?rev=1300806&r1=1300805&r2=1300806&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdComponent.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdComponent.java
Thu Mar 15 03:10:53 2012
@@ -54,8 +54,7 @@ public class CometdComponent extends Def
     private static final transient Logger LOG = LoggerFactory.getLogger(CometdComponent.class);
 
     private final Map<String, ConnectorRef> connectors = new LinkedHashMap<String,
ConnectorRef>();
-
-    private Server server;
+   
     private String sslKeyPassword;
     private String sslPassword;
     private String sslKeystore;
@@ -66,11 +65,13 @@ public class CometdComponent extends Def
     class ConnectorRef {
         Connector connector;
         CometdServlet servlet;
+        Server server;
         int refCount;
 
-        public ConnectorRef(Connector connector, CometdServlet servlet) {
+        public ConnectorRef(Connector connector, CometdServlet servlet, Server server) {
             this.connector = connector;
             this.servlet = servlet;
+            this.server = server;
             increment();
         }
 
@@ -115,11 +116,12 @@ public class CometdComponent extends Def
                     LOG.warn("You use localhost interface! It means that no external connections
will be available."
                             + " Don't you want to use 0.0.0.0 instead (all network interfaces)?");
                 }
-                getServer().addConnector(connector);
+                Server server = createServer();
+                server.addConnector(connector);
 
-                CometdServlet servlet = createServletForConnector(connector, endpoint);
-                connectorRef = new ConnectorRef(connector, servlet);
-                getServer().start();
+                CometdServlet servlet = createServletForConnector(server, connector, endpoint);
+                connectorRef = new ConnectorRef(connector, servlet, server);
+                server.start();
 
                 connectors.put(connectorKey, connectorRef);
             } else {
@@ -153,15 +155,16 @@ public class CometdComponent extends Def
             ConnectorRef connectorRef = connectors.get(connectorKey);
             if (connectorRef != null) {
                 if (connectorRef.decrement() == 0) {
-                    getServer().removeConnector(connectorRef.connector);
+                    connectorRef.server.removeConnector(connectorRef.connector);
                     connectorRef.connector.stop();
+                    connectorRef.server.stop();
                     connectors.remove(connectorKey);
                 }
             }
         }
     }
 
-    protected CometdServlet createServletForConnector(Connector connector, CometdEndpoint
endpoint) throws Exception {
+    protected CometdServlet createServletForConnector(Server server, Connector connector,
CometdEndpoint endpoint) throws Exception {
         CometdServlet servlet = new CometdServlet();
 
         ServletContextHandler context = new ServletContextHandler(server, "/", ServletContextHandler.NO_SECURITY
| ServletContextHandler.NO_SESSIONS);
@@ -228,17 +231,6 @@ public class CometdComponent extends Def
         return sslSocketConnector;
     }
 
-    public Server getServer() throws Exception {
-        if (server == null) {
-            server = createServer();
-        }
-        return server;
-    }
-
-    public void setServer(Server server) {
-        this.server = server;
-    }
-
     public String getSslKeyPassword() {
         return sslKeyPassword;
     }
@@ -307,10 +299,7 @@ public class CometdComponent extends Def
             connectorRef.connector.stop();
         }
         connectors.clear();
-
-        if (server != null) {
-            server.stop();
-        }
+       
         super.doStop();
     }
 

Propchange: camel/branches/camel-2.9.x/components/camel-solr/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Mar 15 03:10:53 2012
@@ -1 +1 @@
-/camel/trunk/components/camel-solr:1227197-1298579,1298795,1298821,1298993,1299399
+/camel/trunk/components/camel-solr:1227197-1298579,1298795,1298821,1298993,1299399,1300805



Mime
View raw message