/* this is the following code. It runs well but very slow. any suggestion?
*/
public Identity getDefaultObjectByServerId(String s){
try{
ServerInfo sInfo = getAdminPrx().getServerInfo(s); //getAdminPrx() return IceGrid.AdminPrx
AdapterDescriptor adapter= (AdapterDescriptor)sInfo.descriptor.adapters.get(0 );
for (Object object : adapter.objects) {
ObjectDescriptor obj = (ObjectDescriptor)object;
if (obj.type.equals("management::Manageable")){
return obj.id;
}
}
}
catch(ServerNotExistException e){
log.error("cannot reach server " + s + " :" + e.toString());
}
return null;
}

Reply With Quote