@Override
public void onFailure(Throwable caught) {
numResponses++;
ServerInstance instance = createInstanceModel(handle);
instance.setRunning(false);
instanceList.add(instance);
checkComplete(instanceList, callback);
}
@Override
public void onSuccess(DMRResponse result) {
numResponses++;
ModelNode statusResponse = result.get();
ModelNode payload = statusResponse.get(RESULT);
ServerInstance instance = createInstanceModel(handle);
instanceList.add(instance);
if(statusResponse.isFailure())
{
instance.setRunning(false);
}
else
{
instance.setRunning(handle.isStarted());
if(payload.hasDefined("server-state"))
{
String state = payload.get("server-state").asString();
if(state.equals("reload-required"))
{
instance.setFlag(ServerFlag.RELOAD_REQUIRED);
}
else if (state.equals("restart-required"))
{
instance.setFlag(ServerFlag.RESTART_REQUIRED);
}
}
}