private Object findClusteredObject(final String name) throws CMIContextException {
try {
clusterViewManager.addObjectToWatch(name);
if(!clusterViewManager.isProxyEnabled(name)) {
try {
return findStubOrProxy(name);
} catch (NamingException e) {
LOGGER.error("Cannot get a proxy (or stub) for {0}.", name, e);
throw new CMIContextException("Cannot get a proxy (or stub) for " + name, e);
}
}
CMIProxy cmiProxy;
try {
cmiProxy = CMIProxyFactory.newCMIProxy(clusterViewManager, name, protocol);
} catch (Exception e) {
LOGGER.error("Cannot get a CMI proxy for {0}.", name, e);
throw new CMIContextException("Cannot get a CMI proxy for " + name, e);
}
return cmiProxy;
} catch (Exception e) {
LOGGER.error("Cannot find the clustered object object {0}", name, e);
throw new CMIContextException(
"Cannot find the clustered object object " + name, e);
}
}