You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/09/10 16:17:43 UTC
[1/4] git commit: CAMEL-7799 Remove the useless timer from
NettyProducer
Repository: camel
Updated Branches:
refs/heads/master 3c99fa97d -> 456f75bd2
CAMEL-7799 Remove the useless timer from NettyProducer
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/456f75bd
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/456f75bd
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/456f75bd
Branch: refs/heads/master
Commit: 456f75bd2017a3f1ab147c3d7b438501c533a605
Parents: db6baef
Author: Willem Jiang <wi...@gmail.com>
Authored: Wed Sep 10 21:49:40 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Wed Sep 10 21:49:55 2014 +0800
----------------------------------------------------------------------
.../org/apache/camel/component/netty4/NettyProducer.java | 8 --------
1 file changed, 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/456f75bd/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java
index 53b777f..7f54990 100644
--- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java
+++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java
@@ -63,7 +63,6 @@ public class NettyProducer extends DefaultAsyncProducer {
private CamelLogger noReplyLogger;
private EventLoopGroup workerGroup;
private ObjectPool<Channel> pool;
- private Timer timer;
private Map<Channel, NettyCamelState> nettyCamelStatesMap = new ConcurrentHashMap<Channel, NettyCamelState>();
public NettyProducer(NettyEndpoint nettyEndpoint, NettyConfiguration configuration) {
@@ -122,8 +121,6 @@ public class NettyProducer extends DefaultAsyncProducer {
}
}
- timer = new HashedWheelTimer();
-
// setup pipeline factory
ClientInitializerFactory factory = configuration.getClientPipelineFactory();
if (factory != null) {
@@ -161,11 +158,6 @@ public class NettyProducer extends DefaultAsyncProducer {
pool = null;
}
- if (timer != null) {
- timer.stop();
- timer = null;
- }
-
super.doStop();
}
[4/4] git commit: CAMEL-7799 Clean up options of camel-netty4 and
camel-netty4-http component
Posted by ni...@apache.org.
CAMEL-7799 Clean up options of camel-netty4 and camel-netty4-http component
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/314f4330
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/314f4330
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/314f4330
Branch: refs/heads/master
Commit: 314f4330c417fe4da90f88ec0dc4d22031368793
Parents: 3c99fa9
Author: Willem Jiang <wi...@gmail.com>
Authored: Wed Sep 10 15:58:51 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Wed Sep 10 21:49:55 2014 +0800
----------------------------------------------------------------------
.../netty4/http/HttpServerInitializerFactory.java | 2 +-
.../netty4/DefaultServerInitializerFactory.java | 2 +-
.../apache/camel/component/netty4/NettyComponent.java | 7 ++++++-
.../camel/component/netty4/NettyConfiguration.java | 11 +++++------
.../NettyUseSharedWorkerThreadPoolManyRoutesTest.java | 2 +-
.../netty4/NettyUseSharedWorkerThreadPoolTest.java | 6 +++---
.../netty4/SpringNettyUseSharedWorkerThreadPoolTest.xml | 6 +++---
7 files changed, 20 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/314f4330/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpServerInitializerFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpServerInitializerFactory.java b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpServerInitializerFactory.java
index 524e697..a98aef0 100644
--- a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpServerInitializerFactory.java
+++ b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/HttpServerInitializerFactory.java
@@ -95,7 +95,7 @@ public class HttpServerInitializerFactory extends ServerInitializerFactory {
int port = consumer.getConfiguration().getPort();
ChannelHandler handler = consumer.getEndpoint().getComponent().getMultiplexChannelHandler(port).getChannelHandler();
- if (consumer.getConfiguration().isOrderedThreadPoolExecutor()) {
+ if (consumer.getConfiguration().isUsingExecutorService()) {
EventExecutorGroup applicationExecutor = consumer.getEndpoint().getComponent().getExecutorService();
pipeline.addLast(applicationExecutor, "handler", handler);
} else {
http://git-wip-us.apache.org/repos/asf/camel/blob/314f4330/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultServerInitializerFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultServerInitializerFactory.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultServerInitializerFactory.java
index 855a753..b942c8a 100644
--- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultServerInitializerFactory.java
+++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultServerInitializerFactory.java
@@ -100,7 +100,7 @@ public class DefaultServerInitializerFactory extends ServerInitializerFactory {
addToPipeline("decoder-" + x, channelPipeline, decoder);
}
- if (consumer.getConfiguration().isOrderedThreadPoolExecutor()) {
+ if (consumer.getConfiguration().isUsingExecutorService()) {
// Just use EventExecutorGroup from the Netty Component
EventExecutorGroup applicationExecutor = consumer.getEndpoint().getComponent().getExecutorService();
addToPipeline("handler", channelPipeline, applicationExecutor, new ServerChannelHandler(consumer));
http://git-wip-us.apache.org/repos/asf/camel/blob/314f4330/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyComponent.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyComponent.java
index f23431a..3f01191 100644
--- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyComponent.java
+++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyComponent.java
@@ -99,6 +99,10 @@ public class NettyComponent extends UriEndpointComponent {
public static Timer getTimer() {
return timer;
}
+
+ public void setExecutorService(EventExecutorGroup executorServcie) {
+ this.executorService = executorService;
+ }
public synchronized EventExecutorGroup getExecutorService() {
if (executorService == null) {
@@ -116,7 +120,8 @@ public class NettyComponent extends UriEndpointComponent {
if (configuration == null) {
configuration = new NettyConfiguration();
}
- if (configuration.isOrderedThreadPoolExecutor()) {
+
+ if (configuration.isUsingExecutorService() && executorService == null) {
executorService = createExecutorService();
}
http://git-wip-us.apache.org/repos/asf/camel/blob/314f4330/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java
index dbcab81..472e50f 100644
--- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java
+++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java
@@ -79,8 +79,7 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem
@UriParam
private int maximumPoolSize = 16;
@UriParam
- // TODO we need to rename this property
- private boolean orderedThreadPoolExecutor = true;
+ private boolean usingExecutorService = true;
@UriParam
private int producerPoolMaxActive = -1;
@UriParam
@@ -405,12 +404,12 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem
this.maximumPoolSize = maximumPoolSize;
}
- public boolean isOrderedThreadPoolExecutor() {
- return orderedThreadPoolExecutor;
+ public boolean isUsingExecutorService() {
+ return usingExecutorService;
}
- public void setOrderedThreadPoolExecutor(boolean orderedThreadPoolExecutor) {
- this.orderedThreadPoolExecutor = orderedThreadPoolExecutor;
+ public void setUsingExecutorService(boolean usingExecutorService) {
+ this.usingExecutorService = usingExecutorService;
}
public int getProducerPoolMaxActive() {
http://git-wip-us.apache.org/repos/asf/camel/blob/314f4330/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUseSharedWorkerThreadPoolManyRoutesTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUseSharedWorkerThreadPoolManyRoutesTest.java b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUseSharedWorkerThreadPoolManyRoutesTest.java
index fa71b39..d05ff05 100644
--- a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUseSharedWorkerThreadPoolManyRoutesTest.java
+++ b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUseSharedWorkerThreadPoolManyRoutesTest.java
@@ -70,7 +70,7 @@ public class NettyUseSharedWorkerThreadPoolManyRoutesTest extends BaseNettyTest
jndi.bind("sharedBoss", sharedBoosGroup);
for (int i = 0; i < 100; i++) {
- from("netty4:tcp://localhost:" + getNextPort() + "?textline=true&sync=true&orderedThreadPoolExecutor=false"
+ from("netty4:tcp://localhost:" + getNextPort() + "?textline=true&sync=true&usingExecutorService=false"
+ "&bossGroup=#sharedBoss&workerGroup=#sharedWorker")
.validate(body().isInstanceOf(String.class))
.to("log:result")
http://git-wip-us.apache.org/repos/asf/camel/blob/314f4330/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUseSharedWorkerThreadPoolTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUseSharedWorkerThreadPoolTest.java b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUseSharedWorkerThreadPoolTest.java
index 31a5be9..a78d81e 100644
--- a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUseSharedWorkerThreadPoolTest.java
+++ b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUseSharedWorkerThreadPoolTest.java
@@ -80,19 +80,19 @@ public class NettyUseSharedWorkerThreadPoolTest extends BaseNettyTest {
port2 = getNextPort();
port3 = getNextPort();
- from("netty4:tcp://localhost:" + port + "?textline=true&sync=true&workerGroup=#sharedServerPool&orderedThreadPoolExecutor=false")
+ from("netty4:tcp://localhost:" + port + "?textline=true&sync=true&workerGroup=#sharedServerPool&usingExecutorService=false")
.validate(body().isInstanceOf(String.class))
.to("log:result")
.to("mock:result")
.transform(body().regexReplaceAll("Hello", "Bye"));
- from("netty4:tcp://localhost:" + port2 + "?textline=true&sync=true&workerGroup=#sharedServerPool&orderedThreadPoolExecutor=false")
+ from("netty4:tcp://localhost:" + port2 + "?textline=true&sync=true&workerGroup=#sharedServerPool&usingExecutorService=false")
.validate(body().isInstanceOf(String.class))
.to("log:result")
.to("mock:result")
.transform(body().regexReplaceAll("Hello", "Hi"));
- from("netty4:tcp://localhost:" + port3 + "?textline=true&sync=true&workerGroup=#sharedServerPool&orderedThreadPoolExecutor=false")
+ from("netty4:tcp://localhost:" + port3 + "?textline=true&sync=true&workerGroup=#sharedServerPool&usingExecutorService=false")
.validate(body().isInstanceOf(String.class))
.to("log:result")
.to("mock:result")
http://git-wip-us.apache.org/repos/asf/camel/blob/314f4330/components/camel-netty4/src/test/resources/org/apache/camel/component/netty4/SpringNettyUseSharedWorkerThreadPoolTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-netty4/src/test/resources/org/apache/camel/component/netty4/SpringNettyUseSharedWorkerThreadPoolTest.xml b/components/camel-netty4/src/test/resources/org/apache/camel/component/netty4/SpringNettyUseSharedWorkerThreadPoolTest.xml
index ba79b34..30595b9 100644
--- a/components/camel-netty4/src/test/resources/org/apache/camel/component/netty4/SpringNettyUseSharedWorkerThreadPoolTest.xml
+++ b/components/camel-netty4/src/test/resources/org/apache/camel/component/netty4/SpringNettyUseSharedWorkerThreadPoolTest.xml
@@ -31,19 +31,19 @@
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
- <from uri="netty4:tcp://localhost:5021?textline=true&sync=true&workerGroup=#sharedPool&orderedThreadPoolExecutor=false"/>
+ <from uri="netty4:tcp://localhost:5021?textline=true&sync=true&workerGroup=#sharedPool&usingExecutorService=false"/>
<to uri="log:result"/>
<to uri="mock:result"/>
</route>
<route>
- <from uri="netty4:tcp://localhost:5022?textline=true&sync=true&workerGroup=#sharedPool&orderedThreadPoolExecutor=false"/>
+ <from uri="netty4:tcp://localhost:5022?textline=true&sync=true&workerGroup=#sharedPool&usingExecutorService=false"/>
<to uri="log:result"/>
<to uri="mock:result"/>
</route>
<route>
- <from uri="netty4:tcp://localhost:5023?textline=true&sync=true&workerGroup=#sharedPool&orderedThreadPoolExecutor=false"/>
+ <from uri="netty4:tcp://localhost:5023?textline=true&sync=true&workerGroup=#sharedPool&usingExecutorService=false"/>
<to uri="log:result"/>
<to uri="mock:result"/>
</route>
[3/4] git commit: CAMEL-7799 clean up the code of camel-netty4
Posted by ni...@apache.org.
CAMEL-7799 clean up the code of camel-netty4
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/db6baefd
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/db6baefd
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/db6baefd
Branch: refs/heads/master
Commit: db6baefd2578ab3d06ecca6a2292e75bed0754e0
Parents: 072731e
Author: Willem Jiang <wi...@gmail.com>
Authored: Wed Sep 10 17:37:51 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Wed Sep 10 21:49:55 2014 +0800
----------------------------------------------------------------------
.../netty4/SingleTCPNettyServerBootstrapFactory.java | 12 +++---------
.../netty4/SingleUDPNettyServerBootstrapFactory.java | 6 ++----
2 files changed, 5 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/db6baefd/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SingleTCPNettyServerBootstrapFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SingleTCPNettyServerBootstrapFactory.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SingleTCPNettyServerBootstrapFactory.java
index 6ae3534..3c53d4e 100644
--- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SingleTCPNettyServerBootstrapFactory.java
+++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SingleTCPNettyServerBootstrapFactory.java
@@ -26,7 +26,6 @@ import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.group.ChannelGroup;
-import io.netty.channel.group.ChannelGroupFuture;
import io.netty.channel.group.DefaultChannelGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.util.concurrent.ImmediateEventExecutor;
@@ -146,9 +145,7 @@ public class SingleTCPNettyServerBootstrapFactory extends ServiceSupport impleme
.build();
wg = workerGroup;
}
-
- //channelFactory = new NioServerSocketChannelFactory(bg, wg);
-
+
serverBootstrap = new ServerBootstrap();
serverBootstrap.group(bg, wg).channel(NioServerSocketChannel.class);
serverBootstrap.childOption(ChannelOption.SO_KEEPALIVE, configuration.isKeepAlive());
@@ -183,13 +180,10 @@ public class SingleTCPNettyServerBootstrapFactory extends ServiceSupport impleme
protected void stopServerBootstrap() {
// close all channels
LOG.info("ServerBootstrap unbinding from {}:{}", configuration.getHost(), configuration.getPort());
-
+
LOG.trace("Closing {} channels", allChannels.size());
- ChannelGroupFuture future = allChannels.close();
- future.awaitUninterruptibly();
-
if (allChannels != null) {
- allChannels.close();
+ allChannels.close().awaitUninterruptibly();
}
// and then shutdown the thread pools
http://git-wip-us.apache.org/repos/asf/camel/blob/db6baefd/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SingleUDPNettyServerBootstrapFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SingleUDPNettyServerBootstrapFactory.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SingleUDPNettyServerBootstrapFactory.java
index 8d42699..a545002 100644
--- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SingleUDPNettyServerBootstrapFactory.java
+++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SingleUDPNettyServerBootstrapFactory.java
@@ -28,7 +28,6 @@ import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.group.ChannelGroup;
-import io.netty.channel.group.ChannelGroupFuture;
import io.netty.channel.group.DefaultChannelGroup;
import io.netty.channel.socket.DatagramChannel;
import io.netty.channel.socket.nio.NioDatagramChannel;
@@ -186,9 +185,8 @@ public class SingleUDPNettyServerBootstrapFactory extends ServiceSupport impleme
LOG.info("ConnectionlessBootstrap disconnecting from {}:{}", configuration.getHost(), configuration.getPort());
LOG.trace("Closing {} channels", allChannels.size());
- ChannelGroupFuture future = allChannels.close();
- future.awaitUninterruptibly();
-
+ allChannels.close().awaitUninterruptibly();
+
// and then shutdown the thread pools
if (workerGroup != null) {
workerGroup.shutdownGracefully();
[2/4] git commit: CAMEL-7799 Remove the useless timer from
NettyComponent
Posted by ni...@apache.org.
CAMEL-7799 Remove the useless timer from NettyComponent
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/072731e4
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/072731e4
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/072731e4
Branch: refs/heads/master
Commit: 072731e42a6b734b0fbfa1f013c18b7d55ff1994
Parents: 314f433
Author: Willem Jiang <wi...@gmail.com>
Authored: Wed Sep 10 16:14:15 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Wed Sep 10 21:49:55 2014 +0800
----------------------------------------------------------------------
.../component/netty4/http/NettyHttpComponent.java | 1 -
.../camel/component/netty4/NettyComponent.java | 14 +-------------
.../camel/component/netty4/NettyEndpoint.java | 17 +----------------
.../component/netty4/NettyManualEndpointTest.java | 1 -
4 files changed, 2 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/072731e4/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpComponent.java b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpComponent.java
index c9c212d..7a4b0f7 100644
--- a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpComponent.java
+++ b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpComponent.java
@@ -110,7 +110,6 @@ public class NettyHttpComponent extends NettyComponent implements HeaderFilterSt
String addressUri = URISupport.createRemainingURI(u, parameters).toString();
NettyHttpEndpoint answer = new NettyHttpEndpoint(addressUri, this, config);
- answer.setTimer(getTimer());
// must use a copy of the binding on the endpoint to avoid sharing same instance that can cause side-effects
if (answer.getNettyHttpBinding() == null) {
http://git-wip-us.apache.org/repos/asf/camel/blob/072731e4/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyComponent.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyComponent.java
index 3f01191..fc37f21 100644
--- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyComponent.java
+++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyComponent.java
@@ -33,8 +33,6 @@ import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.concurrent.CamelThreadFactory;
public class NettyComponent extends UriEndpointComponent {
- // use a shared timer for Netty (see javadoc for HashedWheelTimer)
- private static volatile Timer timer;
private NettyConfiguration configuration;
private volatile EventExecutorGroup executorService;
@@ -73,7 +71,6 @@ public class NettyComponent extends UriEndpointComponent {
config.validateConfiguration();
NettyEndpoint nettyEndpoint = new NettyEndpoint(remaining, this, config);
- nettyEndpoint.setTimer(getTimer());
setProperties(nettyEndpoint.getConfiguration(), parameters);
return nettyEndpoint;
}
@@ -95,10 +92,6 @@ public class NettyComponent extends UriEndpointComponent {
public void setConfiguration(NettyConfiguration configuration) {
this.configuration = configuration;
}
-
- public static Timer getTimer() {
- return timer;
- }
public void setExecutorService(EventExecutorGroup executorServcie) {
this.executorService = executorService;
@@ -113,10 +106,7 @@ public class NettyComponent extends UriEndpointComponent {
@Override
protected void doStart() throws Exception {
- if (timer == null) {
- timer = new HashedWheelTimer();
- }
-
+
if (configuration == null) {
configuration = new NettyConfiguration();
}
@@ -139,8 +129,6 @@ public class NettyComponent extends UriEndpointComponent {
@Override
protected void doStop() throws Exception {
- timer.stop();
- timer = null;
if (executorService != null) {
getCamelContext().getExecutorServiceManager().shutdownNow(executorService);
http://git-wip-us.apache.org/repos/asf/camel/blob/072731e4/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyEndpoint.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyEndpoint.java
index 017727e..166059e 100644
--- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyEndpoint.java
+++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyEndpoint.java
@@ -42,9 +42,7 @@ import org.apache.camel.util.ObjectHelper;
public class NettyEndpoint extends DefaultEndpoint {
@UriParam
private NettyConfiguration configuration;
- // TODO do we really need this time in netty4
- private Timer timer;
-
+
public NettyEndpoint(String endpointUri, NettyComponent component, NettyConfiguration configuration) {
super(endpointUri, component);
this.configuration = configuration;
@@ -89,24 +87,11 @@ public class NettyEndpoint extends DefaultEndpoint {
this.configuration = configuration;
}
- public void setTimer(Timer timer) {
- this.timer = timer;
- }
-
- public Timer getTimer() {
- return timer;
- }
-
@Override
protected String createEndpointUri() {
ObjectHelper.notNull(configuration, "configuration");
return "netty4:" + getConfiguration().getProtocol() + "://" + getConfiguration().getHost() + ":" + getConfiguration().getPort();
}
-
- @Override
- protected void doStart() throws Exception {
- ObjectHelper.notNull(timer, "timer");
- }
protected SSLSession getSSLSession(ChannelHandlerContext ctx) {
final SslHandler sslHandler = ctx.pipeline().get(SslHandler.class);
http://git-wip-us.apache.org/repos/asf/camel/blob/072731e4/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyManualEndpointTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyManualEndpointTest.java b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyManualEndpointTest.java
index 6ed15eb..01acc68 100644
--- a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyManualEndpointTest.java
+++ b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyManualEndpointTest.java
@@ -70,7 +70,6 @@ public class NettyManualEndpointTest extends BaseNettyTest {
// create and start endpoint, pass in null as endpoint uri
// as we create this endpoint manually
endpoint = new NettyEndpoint(null, component, nettyConfig);
- endpoint.setTimer(NettyComponent.getTimer());
endpoint.start();
from(endpoint).to("mock:result");