String bindName = "";
NamingEnumeration enumeration = listBindings(context, bindName);
while(enumeration.hasMore())
{
Binding binding = (Binding) enumeration.next();
Detection regMsg = (Detection) binding.getObject();
// No need to detect myself here
if(isRemoteDetection(regMsg))
{
log.debug("Detected id: " + regMsg.getIdentity().getInstanceId() + ", message: " + regMsg);
if(cleanDetect)
{
if(log.isTraceEnabled())
{
log.trace("Doing clean detection.");
}
// Need to actually detect if servers registered in JNDI server
// are actually there (since could die before unregistering)
ClassLoader cl = (ClassLoader) AccessController.doPrivileged( new PrivilegedAction()
{
public Object run()
{
return JNDIDetector.class.getClassLoader();
}
});
if(!checkInvokerServer(regMsg, cl))
{
unregisterDetection(regMsg.getIdentity().getInstanceId());
}
else
{
// Now, let parent handle detection
detect(regMsg);