Wrap a couple of heavier LOG calls in quick tests for enabled.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1440225 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2013-01-30 00:19:45 +00:00
parent 5fc2535edf
commit a5dd237a60
1 changed files with 24 additions and 7 deletions

View File

@ -322,7 +322,10 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
if (l != null) {
l.onStart(this);
}
if (LOG.isInfoEnabled()) {
LOG.info("Network connection between " + localBroker + " and " + remoteBroker + "(" + remoteBrokerName + ") has been established.");
}
} else {
LOG.warn("Bridge was disposed before the startLocalBridge() method was fully executed.");
@ -400,7 +403,9 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
public void stop() throws Exception {
if (started.compareAndSet(true, false)) {
if (disposed.compareAndSet(false, true)) {
if (LOG.isDebugEnabled()) {
LOG.debug(" stopping " + configuration.getBrokerName() + " bridge to " + remoteBrokerName);
}
NetworkBridgeListener l = this.networkBridgeListener;
if (l != null) {
l.onStop(this);
@ -416,12 +421,16 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
serialExecutor.shutdown();
if (!serialExecutor.awaitTermination(5, TimeUnit.SECONDS)) {
List<Runnable> pendingTasks = serialExecutor.shutdownNow();
if (LOG.isInfoEnabled()) {
LOG.info("pending tasks on stop" + pendingTasks);
}
}
localBroker.oneway(new ShutdownInfo());
remoteBroker.oneway(new ShutdownInfo());
} catch (Throwable e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Caught exception sending shutdown", e);
}
} finally {
sendShutdown.countDown();
}
@ -450,10 +459,12 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
if (remoteBrokerInfo != null) {
brokerService.getBroker().removeBroker(null, remoteBrokerInfo);
brokerService.getBroker().networkBridgeStopped(remoteBrokerInfo);
if (LOG.isInfoEnabled()) {
LOG.info(configuration.getBrokerName() + " bridge to " + remoteBrokerName + " stopped");
}
}
}
}
@Override
public void serviceRemoteException(Throwable error) {
@ -756,8 +767,14 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
}
return;
}
if (LOG.isInfoEnabled()) {
LOG.info("Network connection between " + localBroker + " and " + remoteBroker + " shutdown due to a local error: " + error);
}
if (LOG.isDebugEnabled()) {
LOG.debug("The local Exception was:" + error, error);
}
brokerService.getTaskRunnerFactory().execute(new Runnable() {
@Override
public void run() {