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 12:01:07 UTC

svn commit: r581830 - /incubator/servicemix/branches/servicemix-3.1/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ClientFactory.java

Author: gnodet
Date: Thu Oct  4 03:01:06 2007
New Revision: 581830

URL: http://svn.apache.org/viewvc?rev=581830&view=rev
Log:
SM-1082: Inconsistent exception handling in ClientFactory

Modified:
    incubator/servicemix/branches/servicemix-3.1/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ClientFactory.java

Modified: incubator/servicemix/branches/servicemix-3.1/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ClientFactory.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-3.1/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ClientFactory.java?rev=581830&r1=581829&r2=581830&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-3.1/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ClientFactory.java (original)
+++ incubator/servicemix/branches/servicemix-3.1/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ClientFactory.java Thu Oct  4 03:01:06 2007
@@ -38,7 +38,9 @@
     private static final Log logger = 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) {
             logger.warn("Cound not start ClientFactory: " + e);
             if (logger.isDebugEnabled()) {
                 logger.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) {
             logger.warn("Cound not stop ClientFactory: " + e);
             if (logger.isDebugEnabled()) {