if (cluster.isResourceRefExists(jndiName)) {
// delete ResourceRef of Cluster
cluster.deleteResourceRef(jndiName);
// delete ResourceRef for all instances of Cluster
Target tgt = habitat.getService(Target.class);
List<Server> instances = tgt.getInstances(target);
for (Server svr : instances) {
if (svr.isResourceRefExists(jndiName)) {
svr.deleteResourceRef(jndiName);
}
}