* @return the load average of the given instance.
*/
public double getLoadAverageFromInstances(int instanceIndex) {
double loadAverage = -1;
Instance instance;
LoadBalanceAgentServiceStub stub;
String serviceUrl;
// gets the instance and the service
try {
instance = loadAnalyzerTask.getRunningApplicationInstances().get(instanceIndex);
String externalName = instance.getExternalName();
serviceUrl = "https://" + externalName + ":" + loadAnalyzerTask.getServiceHttpsPort() +
services + serviceName;
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.debug("Unable to get the running application instances to get the " +
"load average", e);
}
return loadAverage;
}
// gets the load average of the service instance
try {
stub = new LoadBalanceAgentServiceStub(loadAnalyzerTask.getConfigCtx(), serviceUrl);
loadAverage = stub.getLoadAverage();
} catch (AxisFault axisFault) {
if (log.isDebugEnabled()) {
log.debug("Unable to create the object from the service stub");
}
} catch (RemoteException e) {