synchronized (brokerInfoMutex) {
BrokerInfo remoteBrokerInfo = (BrokerInfo) command;
BrokerId remoteBrokerId = remoteBrokerInfo.getBrokerId();
// lets associate the incoming endpoint with a broker ID so we can refer to it later
Endpoint from = command.getFrom();
if (from == null) {
log.warn("Incoming command does not have a from endpoint: " + command);
}
else {
from.setBrokerInfo(remoteBrokerInfo);
}
if (localBrokerId != null) {
if (localBrokerId.equals(remoteBrokerId)) {
log.info("Disconnecting loop back connection.");
// waitStarted();