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 2013/07/29 08:59:07 UTC
[3/3] git commit: CAMEL-6585 cxfEndpoint should shutdown the bus if
the bus is created by itself.
CAMEL-6585 cxfEndpoint should shutdown the bus if the bus is created by itself.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3d85a192
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3d85a192
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3d85a192
Branch: refs/heads/camel-2.10.x
Commit: 3d85a19205f85d39a08ec280d88fcdb630f43529
Parents: 427c84a
Author: Willem Jiang <ni...@apache.org>
Authored: Mon Jul 29 14:47:21 2013 +0800
Committer: Willem Jiang <ni...@apache.org>
Committed: Mon Jul 29 14:58:04 2013 +0800
----------------------------------------------------------------------
.../java/org/apache/camel/component/cxf/CxfEndpoint.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/3d85a192/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
index 6d8379b..2a328f9 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
@@ -108,6 +108,7 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy
private static final Logger LOG = LoggerFactory.getLogger(CxfEndpoint.class);
protected Bus bus;
+ private boolean createBus;
private String wsdlURL;
private Class<?> serviceClass;
@@ -732,11 +733,13 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy
public void setBus(Bus bus) {
this.bus = bus;
+ this.createBus = false;
}
public Bus getBus() {
if (bus == null) {
bus = CxfEndpointUtils.createBus(getCamelContext());
+ this.createBus = true;
LOG.debug("Using DefaultBus {}", bus);
}
@@ -836,7 +839,13 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy
@Override
protected void doStop() throws Exception {
- // noop
+ // we should consider to shutdown the bus if the bus is created by cxfEndpoint
+ if (createBus && bus != null) {
+ LOG.info("shutdown the bus ... " + bus);
+ getBus().shutdown(false);
+ // clean up the bus to create a new one if the endpoint is started again
+ bus = null;
+ }
}
public void setAddress(String address) {