* @param attrs An array of attributes to search
*
* @return If found, the ComputeResourceInfo entry
*/
public static ComputeResourceInfo getComputeResourceInfo(final Entry[] attrs) {
ComputeResourceInfo computeResourceInfo = null;
for (Entry attr : attrs) {
if (attr.getClass().getName().equals(ComputeResourceInfo.class.getName())) {
if (attr instanceof ComputeResourceInfo) {
computeResourceInfo = (ComputeResourceInfo) attr;
break;
} else {
/*
* This addresses the issue where the discovered service
* has an ComputeResourceInfo but there is a class loading
* problem, which results in the classes being loaded by sibling
* class loaders, and assignability doesnt work.
*/
computeResourceInfo = new ComputeResourceInfo();
try {
Field ha = attr.getClass().getDeclaredField("hostAddress");
Field hn = attr.getClass().getDeclaredField("hostName");
computeResourceInfo.hostAddress = (String) ha.get(attr);
computeResourceInfo.hostName = (String) hn.get(attr);