You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/02/08 17:45:32 UTC
[4/5] camel git commit: CAMEL-9577: Only support suspension if a
component has custom logic
CAMEL-9577: Only support suspension if a component has custom logic
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/fdb19bf1
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/fdb19bf1
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/fdb19bf1
Branch: refs/heads/master
Commit: fdb19bf16b197830aeab07c0f579b800e6de9482
Parents: 2535017
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Feb 8 17:03:58 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Feb 8 17:45:21 2016 +0100
----------------------------------------------------------------------
.../org/apache/camel/component/netty/NettyConsumer.java | 2 ++
.../netty/SingleUDPNettyServerBootstrapFactory.java | 12 +++++++++++-
.../ClientModeTCPNettyServerBootstrapFactory.java | 3 ++-
.../apache/camel/component/netty4/NettyConsumer.java | 2 ++
.../netty4/SingleTCPNettyServerBootstrapFactory.java | 3 ++-
.../netty4/SingleUDPNettyServerBootstrapFactory.java | 4 ++--
6 files changed, 21 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/fdb19bf1/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConsumer.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConsumer.java
index c2cdd6f..3a0d7b3 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConsumer.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConsumer.java
@@ -90,11 +90,13 @@ public class NettyConsumer extends DefaultConsumer implements Suspendable {
@Override
protected void doSuspend() throws Exception {
ServiceHelper.suspendService(nettyServerBootstrapFactory);
+ super.doSuspend();
}
@Override
protected void doResume() throws Exception {
ServiceHelper.resumeService(nettyServerBootstrapFactory);
+ super.doResume();
}
public CamelContext getContext() {
http://git-wip-us.apache.org/repos/asf/camel/blob/fdb19bf1/components/camel-netty/src/main/java/org/apache/camel/component/netty/SingleUDPNettyServerBootstrapFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/SingleUDPNettyServerBootstrapFactory.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/SingleUDPNettyServerBootstrapFactory.java
index eb5f596..7a2567e 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/SingleUDPNettyServerBootstrapFactory.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/SingleUDPNettyServerBootstrapFactory.java
@@ -45,7 +45,7 @@ import org.slf4j.LoggerFactory;
/**
* A {@link NettyServerBootstrapFactory} which is used by a single consumer (not shared).
*/
-public class SingleUDPNettyServerBootstrapFactory extends ServiceSupport implements NettyServerBootstrapFactory {
+public class SingleUDPNettyServerBootstrapFactory extends ServiceSupport implements NettyServerBootstrapFactory, Suspendable {
protected static final Logger LOG = LoggerFactory.getLogger(SingleUDPNettyServerBootstrapFactory.class);
private static final String LOOPBACK_INTERFACE = "lo";
@@ -114,6 +114,16 @@ public class SingleUDPNettyServerBootstrapFactory extends ServiceSupport impleme
stopServerBootstrap();
}
+ @Override
+ protected void doResume() throws Exception {
+ // noop
+ }
+
+ @Override
+ protected void doSuspend() throws Exception {
+ // noop
+ }
+
protected void startServerBootstrap() throws Exception {
// create non-shared worker pool
int count = configuration.getWorkerCount() > 0 ? configuration.getWorkerCount() : NettyHelper.DEFAULT_IO_THREADS;
http://git-wip-us.apache.org/repos/asf/camel/blob/fdb19bf1/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/ClientModeTCPNettyServerBootstrapFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/ClientModeTCPNettyServerBootstrapFactory.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/ClientModeTCPNettyServerBootstrapFactory.java
index 10abe9b..fc9cb2c 100644
--- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/ClientModeTCPNettyServerBootstrapFactory.java
+++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/ClientModeTCPNettyServerBootstrapFactory.java
@@ -32,6 +32,7 @@ import io.netty.channel.EventLoopGroup;
import io.netty.channel.socket.nio.NioSocketChannel;
import org.apache.camel.CamelContext;
+import org.apache.camel.Suspendable;
import org.apache.camel.support.ServiceSupport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,7 +40,7 @@ import org.slf4j.LoggerFactory;
/**
* A {@link NettyServerBootstrapFactory} which is used by a single consumer (not shared).
*/
-public class ClientModeTCPNettyServerBootstrapFactory extends ServiceSupport implements NettyServerBootstrapFactory {
+public class ClientModeTCPNettyServerBootstrapFactory extends ServiceSupport implements NettyServerBootstrapFactory, Suspendable {
protected static final Logger LOG = LoggerFactory.getLogger(ClientModeTCPNettyServerBootstrapFactory.class);
http://git-wip-us.apache.org/repos/asf/camel/blob/fdb19bf1/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConsumer.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConsumer.java
index dad9d95..fbee132 100644
--- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConsumer.java
+++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConsumer.java
@@ -90,11 +90,13 @@ public class NettyConsumer extends DefaultConsumer implements Suspendable {
@Override
protected void doSuspend() throws Exception {
ServiceHelper.suspendService(nettyServerBootstrapFactory);
+ super.doSuspend();
}
@Override
protected void doResume() throws Exception {
ServiceHelper.resumeService(nettyServerBootstrapFactory);
+ super.doResume();
}
public CamelContext getContext() {
http://git-wip-us.apache.org/repos/asf/camel/blob/fdb19bf1/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 9e10ced..49ddbc8 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
@@ -31,6 +31,7 @@ import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.util.concurrent.ImmediateEventExecutor;
import org.apache.camel.CamelContext;
+import org.apache.camel.Suspendable;
import org.apache.camel.support.ServiceSupport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -38,7 +39,7 @@ import org.slf4j.LoggerFactory;
/**
* A {@link NettyServerBootstrapFactory} which is used by a single consumer (not shared).
*/
-public class SingleTCPNettyServerBootstrapFactory extends ServiceSupport implements NettyServerBootstrapFactory {
+public class SingleTCPNettyServerBootstrapFactory extends ServiceSupport implements NettyServerBootstrapFactory, Suspendable {
protected static final Logger LOG = LoggerFactory.getLogger(SingleTCPNettyServerBootstrapFactory.class);
private ChannelGroup allChannels;
http://git-wip-us.apache.org/repos/asf/camel/blob/fdb19bf1/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 e3b262e..5d9d5bd 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
@@ -16,7 +16,6 @@
*/
package org.apache.camel.component.netty4;
-
import java.net.InetSocketAddress;
import java.net.NetworkInterface;
import java.util.concurrent.ThreadFactory;
@@ -33,6 +32,7 @@ import io.netty.channel.socket.DatagramChannel;
import io.netty.channel.socket.nio.NioDatagramChannel;
import io.netty.util.concurrent.ImmediateEventExecutor;
import org.apache.camel.CamelContext;
+import org.apache.camel.Suspendable;
import org.apache.camel.component.netty4.util.SubnetUtils;
import org.apache.camel.support.ServiceSupport;
import org.apache.camel.util.ObjectHelper;
@@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory;
/**
* A {@link NettyServerBootstrapFactory} which is used by a single consumer (not shared).
*/
-public class SingleUDPNettyServerBootstrapFactory extends ServiceSupport implements NettyServerBootstrapFactory {
+public class SingleUDPNettyServerBootstrapFactory extends ServiceSupport implements NettyServerBootstrapFactory, Suspendable {
protected static final Logger LOG = LoggerFactory.getLogger(SingleUDPNettyServerBootstrapFactory.class);
private static final String LOOPBACK_INTERFACE = "lo";