String proxyFactoryKey = this.getSingleRequiredRefAddr(binding.getReference(),
ProxyFactoryReferenceAddressTypes.REF_ADDR_TYPE_PROXY_FACTORY_REGISTRY_KEY);
// first create a new proxy. if we run into problems creating a new proxy,
// let's NOT unbind the existing one since a change in topology should not
// result in loss of proxy factory
ProxyFactory existingProxyFactoryInJNDI = null;
try
{
existingProxyFactoryInJNDI = (ProxyFactory) context.lookup(proxyFactoryKey);
}
catch (NamingException ne)
{
// ignore and skip. If there is not proxyfactory bound or if there is some other
// issue related to naming, let's not try to "update" the proxy factory.
log.debug("Could not update the cluster topology changes to proxyfactory at key " + proxyFactoryKey);
continue;
}
// create a new proxy to proxyfactory with the available information in JNDI Reference,
// the previously bound proxy to the proxyfactory and the beanClusteringInfo which has
// contains the updated information of the cluster topology
ProxyFactory updatedProxyToProxyFactory = this.updateProxyForRemoteProxyFactory(proxyFactoryKey, binding
.getReference(), existingProxyFactoryInJNDI, beanClusteringInfo);
try
{
Util.rebind(context, proxyFactoryKey, updatedProxyToProxyFactory);
log.debug("Bound an updated proxyfactory at key " + proxyFactoryKey);