You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2007/10/04 11:57:38 UTC
svn commit: r581827 -
/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ClientFactory.java
Author: gnodet
Date: Thu Oct 4 02:57:37 2007
New Revision: 581827
URL: http://svn.apache.org/viewvc?rev=581827&view=rev
Log:
SM-1082: Inconsistent exception handling in ClientFactory
Modified:
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ClientFactory.java
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ClientFactory.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ClientFactory.java?rev=581827&r1=581826&r2=581827&view=diff
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ClientFactory.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ClientFactory.java Thu Oct 4 02:57:37 2007
@@ -38,7 +38,9 @@
private static final Log LOG = LogFactory.getLog(ClientFactory.class);
private String jndiName = DEFAULT_JNDI_NAME;
-
+
+ private boolean isFactoryJNDIregistered;
+
public ClientFactory() {
}
@@ -82,13 +84,15 @@
public void start() throws javax.jbi.JBIException {
try {
getContainer().getNamingContext().bind(jndiName, this);
- super.start();
+ isFactoryJNDIregistered = true;
} catch (NamingException e) {
LOG.warn("Cound not start ClientFactory: " + e);
if (LOG.isDebugEnabled()) {
LOG.debug("Could not start ClientFactory", e);
}
+ isFactoryJNDIregistered = false;
}
+ super.start();
}
/**
@@ -97,9 +101,11 @@
* @exception javax.jbi.JBIException if the item fails to stop.
*/
public void stop() throws javax.jbi.JBIException {
+ super.stop();
try {
- super.stop();
- getContainer().getNamingContext().unbind(jndiName);
+ if (isFactoryJNDIregistered) {
+ getContainer().getNamingContext().unbind(jndiName);
+ }
} catch (NamingException e) {
LOG.warn("Cound not stop ClientFactory: " + e);
if (LOG.isDebugEnabled()) {