How to check the status of a operation request on a resource group
Issue
- I am using the following code to invoke a stop operation on JBoss instances that belong in the resource group:
ResourceManagerRemote resourceManager = remoteClient.getResourceManager();
ResourceCriteria resourceCriteria = new ResourceCriteria();
resourceCriteria.addFilterExplicitGroupIds(resourceGroup.getId());
PageList resources = resourceManager.findResourcesByCriteria(subject, resourceCriteria);
System.out.println("No. of resources for ["+resourceGroupName+"] = ["+resources.getTotalSize()+"]");
if(resources.getTotalSize() == 1){
ResourceOperationHistoryCriteria opcrit = new ResourceOperationHistoryCriteria();
Resource resource = (Resource)resources.get(0);
System.out.println("Resource name ["+resource.getName()+"] has an id ["+resource.getId()+"]");
opcrit.addFilterResourceIds(resource.getId());
List<ResourceOperationHistory> history = operationManager.findResourceOperationHistoriesByCriteria(subject, opcrit);
System.out.println("Operational History results on resource group = " + history.size());
ResourceOperationHistory resourceOperationHistory = history.get(history.size()-1);//Gets the first value
System.out.println(resourceOperationHistory.getStatus());
}
This will return a list of operation requests. However, I need to know how to find out which one is the latest request in the returned history table? Is the returned history table given in date order?
Environment
- JBoss Operations Network (JON) 3.x
- JON Command Line Interface (CLI)
- JON remote client API
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
