} else {
running = true;
}
List<ServerDO> serverList = null;
BAMPersistenceManager persistenceManager;
BAMDataServiceAdmin statisticsAdmin = new BAMDataServiceAdmin();
try {
persistenceManager = BAMPersistenceManager.getPersistenceManager(BAMUtil.getRegistry());
if (persistenceManager != null) {
serverList = Arrays.asList(persistenceManager.getMonitoredServersByType(BAMConstants.SERVER_TYPE_PULL));
} else {
throw new BAMException("Can't initialize BAMPersistenceManager");
}
} catch (Exception e) {
if (log.isErrorEnabled()) {
log.error("Error occurred while retrieving the server list for polling data", e);
}
return;
}
if (serverList != null && serverList.size() > 0) {
BackOffCounter backoffcounter = BackOffCounter.getInstance();
for (ServerDO server : serverList) {
boolean isServerUp = isServerUpAndRunning(server);
try {
Boolean state = false;
if(server.getActive()){
state =true;
}
if (state && !(backoffcounter.shouldBackoff(server))&& isServerUp) {
DataPuller svrDataPuller = DataPullerFactory.getDataPuller(server, DataPullerFactory.SERVER_STATISTICS_PULLER);
MonitoredServerServiceInfoAdmin serviceInfoAdmin = new MonitoredServerServiceInfoAdmin();
String[] serviceNames = serviceInfoAdmin.getServiceNames(server);
ServerStatisticsDO svrStatisticsDO = (ServerStatisticsDO) svrDataPuller.pullData(server);
statisticsAdmin.addServerStatistics(svrStatisticsDO);
if (serviceNames != null && serviceNames.length > 0) {
DataPuller dataPuller = DataPullerFactory.getDataPuller(server,DataPullerFactory.SERVICE_STATISTICS_PULLER);
for (String serviceName : serviceNames) {
ServiceStatisticsDO svcStatisticsDO = (ServiceStatisticsDO) dataPuller.pullData(serviceName);
if (svcStatisticsDO != null) {
statisticsAdmin.addServiceStatistics(svcStatisticsDO);
}
ServiceDO svc = persistenceManager.getService(server.getId(), serviceName);
String[] operationNames = serviceInfoAdmin.getOperationNames(server, serviceName);
if (operationNames != null && operationNames.length > 0) {
DataPuller opDataPuller = DataPullerFactory.getDataPuller(server,
DataPullerFactory.OPERTION_STATISTICS_PULLER);