servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r581830 - /incubator/servicemix/branches/servicemix-3.1/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ClientFactory.java
Date Thu, 04 Oct 2007 10:01:07 GMT
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()) {



Mime
View raw message