// check to see if network notification
if(notification instanceof NetworkNotification)
{
log.info("GOT A NETWORK-REGISTRY NOTIFICATION: " + notification.getType());
NetworkNotification networkNotification = (NetworkNotification) notification;
if(NetworkNotification.SERVER_ADDED.equals(networkNotification.getType()))
{ // notification is for new servers being added
log.info("New server(s) have been detected - getting locators and sending welcome messages");
InvokerLocator[] locators = networkNotification.getLocator();
for(int x = 0; x < locators.length; x++)
{
try
{
serversDetected++;
// get the new found server's locator and invoke a call
InvokerLocator newServerLocator = locators[x];
log.info("detected: " + newServerLocator);
invocationSucceeded = false;
makeInvocation(newServerLocator.getLocatorURI());
invocationSucceeded = true;
}
catch(Throwable throwable)
{
throwable.printStackTrace();
}
}
}
else if(NetworkNotification.SERVER_REMOVED.equals(networkNotification.getType()))
{ // notification is for old servers that have gone down
InvokerLocator[] locators = networkNotification.getLocator();
for(int x = 0; x < locators.length; x++)
{
serversDetected--;
log.info("It has been detected that a server has gone down with a locator of: " + locators[x]);
}