camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [1/2] camel git commit: CAMEL-9951: Setup default values for thread-connected properties in WebSocket component
Date Mon, 09 May 2016 11:42:36 GMT
Repository: camel
Updated Branches:
  refs/heads/master fc5a47729 -> cbc1718af


CAMEL-9951: Setup default values for thread-connected properties in WebSocket component


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f89682b9
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f89682b9
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f89682b9

Branch: refs/heads/master
Commit: f89682b9fea3ab393ddd76b6b1c9dfe0ab5d4f86
Parents: fc5a477
Author: Andrea Cosentino <ancosen@gmail.com>
Authored: Mon May 9 13:35:02 2016 +0200
Committer: Andrea Cosentino <ancosen@gmail.com>
Committed: Mon May 9 13:35:02 2016 +0200

----------------------------------------------------------------------
 .../apache/camel/component/websocket/WebsocketComponent.java   | 6 +++++-
 .../camel/component/websocket/WebsocketConsumerRouteTest.java  | 4 ++--
 .../websocket/WebsocketEndpointConfigurationTest.java          | 2 +-
 3 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f89682b9/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java
b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java
index 0e9d1d9..ca0d6f6 100644
--- a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java
+++ b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java
@@ -159,6 +159,7 @@ public class WebsocketComponent extends UriEndpointComponent {
                 }
 
                 server.addConnector(connector);
+
                 LOG.trace("Jetty Connector added: {}", connector.getName());
 
                 // Create ServletContextHandler
@@ -213,6 +214,7 @@ public class WebsocketComponent extends UriEndpointComponent {
                 WebsocketProducer producer = WebsocketProducer.class.cast(prodcon);
                 producer.setStore(connectorRef.memoryStore);
             }
+            
         }
     }
 
@@ -339,7 +341,9 @@ public class WebsocketComponent extends UriEndpointComponent {
     protected Server createServer() throws Exception {
         Server server = null;
         if (minThreads == null && maxThreads == null && getThreadPool() ==
null) {
-            throw new RuntimeCamelException("Error creating JettyWebSocketServer. MinThreads/MaxThreads
or ThreadPool must be defined");
+            minThreads = 1;
+            // 1+selectors+acceptors
+            maxThreads = 1 + Runtime.getRuntime().availableProcessors() * 2;
         }
         // configure thread pool if min/max given
         if (minThreads != null || maxThreads != null) {

http://git-wip-us.apache.org/repos/asf/camel/blob/f89682b9/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketConsumerRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketConsumerRouteTest.java
b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketConsumerRouteTest.java
index 20b2f40..97ff276 100644
--- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketConsumerRouteTest.java
+++ b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketConsumerRouteTest.java
@@ -109,8 +109,8 @@ public class WebsocketConsumerRouteTest extends CamelTestSupport {
             public void configure() {
                 WebsocketComponent websocketComponent = (WebsocketComponent) context.getComponent("websocket");
                 websocketComponent.setPort(port);
-                websocketComponent.setMaxThreads(20);
-                websocketComponent.setMinThreads(1);
+//                websocketComponent.setMaxThreads(20);
+//                websocketComponent.setMinThreads(1);
 
                 from("websocket://echo")
                     .log(">>> Message received from WebSocket Client : ${body}")

http://git-wip-us.apache.org/repos/asf/camel/blob/f89682b9/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketEndpointConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketEndpointConfigurationTest.java
b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketEndpointConfigurationTest.java
index 7d7d9aa..70bb917 100644
--- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketEndpointConfigurationTest.java
+++ b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketEndpointConfigurationTest.java
@@ -57,7 +57,7 @@ public class WebsocketEndpointConfigurationTest extends CamelTestSupport
{
         assertEquals("Get a worng maxIdleTime", "3000", maxIdleTime);
     }
     
-    @Test(expected = RuntimeException.class)
+    @Test
     public void testSetServletNoMinThreadsNoMaxThreadsNoThreadPool() throws Exception {
         port = AvailablePortFinder.getNextAvailable(16331);
         String uri = "websocket://localhost:" + port + "/bar?bufferSize=65000&maxIdleTime=3000";


Mime
View raw message