BrokerDAO bkrDAO = getDBManager().getDAOFactory().getBrokerDAO();
HashMap bkrMap = bkrDAO.getAllBrokerInfos(conn, false);
Iterator itr = bkrMap.values().iterator();
long currentTime = System.currentTimeMillis();
while ( itr.hasNext() ) {
HABrokerInfo bkrInfo = (HABrokerInfo)itr.next();
int state = bkrInfo.getState();
if ( !BrokerState.getState(state).isActiveState() ) {
continue; // broker is not active
}
// We've a broker in active state, re-verify w/ last heartbeat;
// If heartbeat is older than 3 minutes then consider it not active
long lastHeartBeat = bkrInfo.getHeartbeat();
if ( lastHeartBeat + 180000 > currentTime ) {
isActive = true;
break;
}
}