activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r493696 - /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
Date Sun, 07 Jan 2007 10:43:39 GMT
Author: rajdavies
Date: Sun Jan  7 02:43:38 2007
New Revision: 493696

URL: http://svn.apache.org/viewvc?view=rev&rev=493696
Log:
Fix for http://issues.apache.org/activemq/browse/AMQ-1117

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java?view=diff&rev=493696&r1=493695&r2=493696
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
Sun Jan  7 02:43:38 2007
@@ -59,6 +59,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import java.security.GeneralSecurityException;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -139,7 +140,7 @@
                 //clear any subscriptions - to try and prevent the bridge from stalling the
broker
                 if( remoteInterupted.compareAndSet(false, true) ) {
                 	
-                    log.debug("Outbound transport to " + remoteBrokerName + " interrupted.");
                                       
+                    log.info("Outbound transport to " + remoteBrokerName + " interrupted.");
                                       
 
                 	if( localBridgeStarted.get() ) {
 	                    clearDownSubscriptions();
@@ -180,7 +181,7 @@
                         startLocalBridge();
                         remoteBridgeStarted.set(true);
                         startedLatch.countDown();
-                        log.debug("Outbound transport to " + remoteBrokerName + " resumed");
  
+                        log.info("Outbound transport to " + remoteBrokerName + " resumed");
  
                     }catch(Exception e) {
                         log.error("Caught exception  from local start in resume transport",e
);
                     }
@@ -297,39 +298,48 @@
         }
     }
 
-    public void stop() throws Exception {
-        log.debug(" stopping "+localBrokerName+ " bridge to " + remoteBrokerName + " is disposed
already ? "+disposed);
-        if (!disposed) {
-			try {
-				disposed = true;
-
-				remoteBridgeStarted.set(false);
-				
-				localBroker.oneway(new ShutdownInfo());
-				remoteBroker.oneway(new ShutdownInfo());
-				
-			} catch (IOException e) {
-				log.debug("Caught exception stopping", e);
-			} finally {
-				ServiceStopper ss = new ServiceStopper();
-				ss.stop(localBroker);
-				ss.stop(remoteBroker);
-				ss.throwFirstException();
-			}
-		}
-        log.debug(localBrokerName+ " bridge to " + remoteBrokerName + " stopped");
+    public void stop() throws Exception{
+        log.debug(" stopping "+localBrokerName+" bridge to "+remoteBrokerName+" is disposed
already ? "+disposed);
+        boolean wasDisposedAlready=disposed;
+        if(!disposed){
+            try{
+                disposed=true;
+                remoteBridgeStarted.set(false);
+                localBroker.oneway(new ShutdownInfo());
+                remoteBroker.oneway(new ShutdownInfo());
+            }catch(IOException e){
+                log.info("Caught exception stopping",e);
+            }finally{
+                ServiceStopper ss=new ServiceStopper();
+                ss.stop(localBroker);
+                ss.stop(remoteBroker);
+                ss.throwFirstException();
+            }
+        }
+        if(wasDisposedAlready){
+            log.debug(localBrokerName+" bridge to "+remoteBrokerName+" stopped");
+        }else{
+            log.info(localBrokerName+" bridge to "+remoteBrokerName+" stopped");
+        }
     }
     
-    protected void serviceRemoteException(Throwable error) {
-    	if( !disposed ) {
-	        log.info("Network connection between "+localBroker+" and "+remoteBroker+" shutdown
due to a remote error: "+error);
-	        log.debug("The remote Exception was: "+error, error);
-	        new Thread() {
-	        	public void run() {
-	                ServiceSupport.dispose(DemandForwardingBridgeSupport.this);
-	        	}
-	        }.start();
-    	}
+    protected void serviceRemoteException(Throwable error){
+        if(!disposed){
+            if(error instanceof SecurityException||error instanceof GeneralSecurityException){
+                log.error("Network connection between "+localBroker+" and "+remoteBroker
+                        +" shutdown due to a remote error: "+error);
+            }else{
+                log.warn("Network connection between "+localBroker+" and "+remoteBroker
+                        +" shutdown due to a remote error: "+error);
+            }
+            log.debug("The remote Exception was: "+error,error);
+            new Thread(){
+
+                public void run(){
+                    ServiceSupport.dispose(DemandForwardingBridgeSupport.this);
+                }
+            }.start();
+        }
     }
 
     protected void serviceRemoteCommand(Command command) {



Mime
View raw message