}
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);
for (String operationName : operationNames) {
OperationDO operationDO = new OperationDO();
operationDO.setName(operationName);
operationDO.setServiceID(svc.getId());
OperationStatisticsDO opStatisticsDO;
opStatisticsDO = (OperationStatisticsDO) opDataPuller.pullData(operationDO);
statisticsAdmin.addOperationStatistics(opStatisticsDO);
}
}
}
}
// Successfully collected data from this server... hence no more backing off.
backoffcounter.resetFailCount(server);
}
} catch (Exception e) {
backoffcounter.incrementFailCount(server);
if (log.isErrorEnabled()) {
log.error("Error occurred while polling data from server " + server.getServerURL(), e);
}
}
}