From e349089a8d3920cb2d8f2ec1252f944b93aece7f Mon Sep 17 00:00:00 2001 From: Robert Davies Date: Sun, 7 Jan 2007 10:43:38 +0000 Subject: [PATCH] Fix for http://issues.apache.org/activemq/browse/AMQ-1117 git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@493696 13f79535-47bb-0310-9956-ffa450edef68 --- .../DemandForwardingBridgeSupport.java | 76 +++++++++++-------- 1 file changed, 43 insertions(+), 33 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java b/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java index e49ed3d725..8f37ae419f 100644 --- a/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java @@ -59,6 +59,7 @@ import org.apache.activemq.util.ServiceSupport; 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 @@ public abstract class DemandForwardingBridgeSupport implements Bridge { //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 @@ public abstract class DemandForwardingBridgeSupport implements Bridge { 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 abstract class DemandForwardingBridgeSupport implements Bridge { } } - 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) {