git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@493696 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2007-01-07 10:43:38 +00:00
parent e76feb6b8e
commit e349089a8d
1 changed files with 43 additions and 33 deletions

View File

@ -59,6 +59,7 @@ import org.apache.activemq.util.ServiceSupport;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import java.security.GeneralSecurityException;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean; 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 //clear any subscriptions - to try and prevent the bridge from stalling the broker
if( remoteInterupted.compareAndSet(false, true) ) { if( remoteInterupted.compareAndSet(false, true) ) {
log.debug("Outbound transport to " + remoteBrokerName + " interrupted."); log.info("Outbound transport to " + remoteBrokerName + " interrupted.");
if( localBridgeStarted.get() ) { if( localBridgeStarted.get() ) {
clearDownSubscriptions(); clearDownSubscriptions();
@ -180,7 +181,7 @@ public abstract class DemandForwardingBridgeSupport implements Bridge {
startLocalBridge(); startLocalBridge();
remoteBridgeStarted.set(true); remoteBridgeStarted.set(true);
startedLatch.countDown(); startedLatch.countDown();
log.debug("Outbound transport to " + remoteBrokerName + " resumed"); log.info("Outbound transport to " + remoteBrokerName + " resumed");
}catch(Exception e) { }catch(Exception e) {
log.error("Caught exception from local start in resume transport",e ); log.error("Caught exception from local start in resume transport",e );
} }
@ -299,17 +300,15 @@ public abstract class DemandForwardingBridgeSupport implements Bridge {
public void stop() throws Exception{ public void stop() throws Exception{
log.debug(" stopping "+localBrokerName+" bridge to "+remoteBrokerName+" is disposed already ? "+disposed); log.debug(" stopping "+localBrokerName+" bridge to "+remoteBrokerName+" is disposed already ? "+disposed);
boolean wasDisposedAlready=disposed;
if(!disposed){ if(!disposed){
try{ try{
disposed=true; disposed=true;
remoteBridgeStarted.set(false); remoteBridgeStarted.set(false);
localBroker.oneway(new ShutdownInfo()); localBroker.oneway(new ShutdownInfo());
remoteBroker.oneway(new ShutdownInfo()); remoteBroker.oneway(new ShutdownInfo());
}catch(IOException e){ }catch(IOException e){
log.debug("Caught exception stopping", e); log.info("Caught exception stopping",e);
}finally{ }finally{
ServiceStopper ss=new ServiceStopper(); ServiceStopper ss=new ServiceStopper();
ss.stop(localBroker); ss.stop(localBroker);
@ -317,14 +316,25 @@ public abstract class DemandForwardingBridgeSupport implements Bridge {
ss.throwFirstException(); ss.throwFirstException();
} }
} }
if(wasDisposedAlready){
log.debug(localBrokerName+" bridge to "+remoteBrokerName+" stopped"); log.debug(localBrokerName+" bridge to "+remoteBrokerName+" stopped");
}else{
log.info(localBrokerName+" bridge to "+remoteBrokerName+" stopped");
}
} }
protected void serviceRemoteException(Throwable error){ protected void serviceRemoteException(Throwable error){
if(!disposed){ if(!disposed){
log.info("Network connection between "+localBroker+" and "+remoteBroker+" shutdown due to a remote error: "+error); 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); log.debug("The remote Exception was: "+error,error);
new Thread(){ new Thread(){
public void run(){ public void run(){
ServiceSupport.dispose(DemandForwardingBridgeSupport.this); ServiceSupport.dispose(DemandForwardingBridgeSupport.this);
} }