String queryString = "WebSphere:cell="+cellName+",node="+nodeName+",process="+serverName+",
type=RasLoggingService,*" ;
Set<ObjectName> objectMBeans = null;
try {
ObjectName queryName = new ObjectName(queryString);
objectMBeans = (Set<ObjectName>)adminClient.queryNames(queryName, null);
if (objectMBeans.size() > 1) {
// error handling code to deal with the case where we get more than one name returned.
}
} catch (MalformedObjectNameException e) {
// error handling code
} catch (ConnectorException e) {
// error handling code
}
if (objectMBeans.isEmpty()) {
// error handling code to deal with the case where the MBean is not found
}
Iterator<ObjectName> objectNames = objectMBeans.iterator() ;
ObjectName objectName = objectNames.next() ;