/** * When a new server is detected or an old server goes away, this method will be notified. This method notifies all * listeners when added/removed/updated notifications are received. * * @see NotificationListener#handleNotification(Notification, Object) */ public void handleNotification(Notification notification, Object handback) { // check to see if its a network notification if (notification instanceof NetworkNotification) { LOG.debug(CommI18NResourceKeys.GOT_NOTIF, notification.getType()); NetworkNotification networkNotification = (NetworkNotification) notification; if (NetworkNotification.SERVER_ADDED.equals(networkNotification.getType())) { serverAddedNotification(networkNotification); } else if (NetworkNotification.SERVER_REMOVED.equals(networkNotification.getType())) { serverRemovedNotification(networkNotification); } else if (NetworkNotification.SERVER_UPDATED.equals(networkNotification.getType())) { serverUpdatedNotification(networkNotification); } } return; }
/** * Processes the {@link NetworkNotification#SERVER_REMOVED} notification. This notification means a previously known * "server VM" has gone offline and has taken all of its remote endpoints with it. * * @param networkNotification the notification */ private void serverRemovedNotification(NetworkNotification networkNotification) { List<AutoDiscoveryListener> listeners_copy; InvokerLocator[] notif_locators = networkNotification.getLocator(); synchronized (m_lock) { // the server has gone down, remove it from our map of known servers m_discoveredServers.remove(networkNotification.getIdentity()); // make a copy while we are synchronized - then release the lock so we let other notifications to get processed listeners_copy = new ArrayList<AutoDiscoveryListener>(m_discoveryListeners); } // notify all of our listeners of the invoker locators that have gone down for (int x = 0; x < notif_locators.length; x++) { notifyListenersOffline(listeners_copy, notif_locators[x]); } return; }
public void run() { broadcaster.sendNotification(new NetworkNotification(objectName, NetworkNotification.SERVER_UPDATED, identity, invokers)); } }.start();
if(NetworkNotification.SERVER_ADDED.equals(networkNotification.getType())) InvokerLocator[] locators = networkNotification.getLocator(); for(int x = 0; x < locators.length; x++) else if(NetworkNotification.SERVER_REMOVED.equals(networkNotification.getType())) InvokerLocator[] locators = networkNotification.getLocator(); for(int x = 0; x < locators.length; x++)
String type = nn.getType(); if(type.equals(NetworkNotification.SERVER_ADDED)) Identity ident = nn.getIdentity(); MBeanServerLocator l = new MBeanServerLocator(ident); foundMBeanServer(l); Identity ident = nn.getIdentity(); MBeanServerLocator l = new MBeanServerLocator(ident); lostMBeanServer(l);
String sessionId = nn.getIdentity().getJMXId(); List failed = new ArrayList(); synchronized(listeners) if(log.isTraceEnabled()) log.trace("++ Removed orphaned listener because server failed: " + nn.getIdentity());
if(NetworkNotification.SERVER_ADDED.equals(networkNotification.getType())) InvokerLocator[] locators = networkNotification.getLocator(); for(int x = 0; x < locators.length; x++) else if(NetworkNotification.SERVER_REMOVED.equals(networkNotification.getType())) InvokerLocator[] locators = networkNotification.getLocator(); for(int x = 0; x < locators.length; x++)
/** * Processes the {@link NetworkNotification#SERVER_REMOVED} notification. This notification means a previously known * "server VM" has gone offline and has taken all of its remote endpoints with it. * * @param networkNotification the notification */ private void serverRemovedNotification(NetworkNotification networkNotification) { List<AutoDiscoveryListener> listeners_copy; InvokerLocator[] notif_locators = networkNotification.getLocator(); synchronized (m_lock) { // the server has gone down, remove it from our map of known servers m_discoveredServers.remove(networkNotification.getIdentity()); // make a copy while we are synchronized - then release the lock so we let other notifications to get processed listeners_copy = new ArrayList<AutoDiscoveryListener>(m_discoveryListeners); } // notify all of our listeners of the invoker locators that have gone down for (int x = 0; x < notif_locators.length; x++) { notifyListenersOffline(listeners_copy, notif_locators[x]); } return; }
/** * When a new server is detected or an old server goes away, this method will be notified. This method notifies all * listeners when added/removed/updated notifications are received. * * @see NotificationListener#handleNotification(Notification, Object) */ public void handleNotification(Notification notification, Object handback) { // check to see if its a network notification if (notification instanceof NetworkNotification) { LOG.debug(CommI18NResourceKeys.GOT_NOTIF, notification.getType()); NetworkNotification networkNotification = (NetworkNotification) notification; if (NetworkNotification.SERVER_ADDED.equals(networkNotification.getType())) { serverAddedNotification(networkNotification); } else if (NetworkNotification.SERVER_REMOVED.equals(networkNotification.getType())) { serverRemovedNotification(networkNotification); } else if (NetworkNotification.SERVER_UPDATED.equals(networkNotification.getType())) { serverUpdatedNotification(networkNotification); } } return; }
public void run() { broadcaster.sendNotification(new NetworkNotification(objectName, NetworkNotification.SERVER_ADDED, identity, invokers)); } }.start();
InvokerLocator[] notif_locators = networkNotification.getLocator(); List<InvokerLocator> server_invokers = m_discoveredServers.get(networkNotification.getIdentity()); if (server_invokers == null) { server_invokers = new ArrayList<InvokerLocator>(networkNotification.getLocator().length); m_discoveredServers.put(networkNotification.getIdentity(), server_invokers);
/** * Receives notifications from the Network Registry indicating that servers are either coming on or offline. * * @see NotificationListener#handleNotification(javax.management.Notification, java.lang.Object) */ public void handleNotification(Notification notification, Object handback) { // check to see if it is a network registry notification if (notification instanceof NetworkNotification) { NetworkNotification networkNotification = (NetworkNotification) notification; String notifType = networkNotification.getType(); // check to see if notification is for new servers being added if (NetworkNotification.SERVER_ADDED.equals(notifType)) { discoveredNewServers(networkNotification); } else if (NetworkNotification.SERVER_REMOVED.equals(notifType)) { discoveredRemovedServers(networkNotification); } else if (NetworkNotification.SERVER_UPDATED.equals(notifType)) { discoveredUpdatedServers(networkNotification); } else if (NetworkNotification.DOMAIN_CHANGED.equals(notifType)) { discoveredChangedDomain(networkNotification); } else { getLog().warn(CommI18NResourceKeys.UNKNOWN_NOTIF_TYPE, notifType); } } else { getLog().warn(CommI18NResourceKeys.UNKNOWN_NOTIF, notification.getClass()); } return; }
public void run() { broadcaster.sendNotification(new NetworkNotification(objectName, NetworkNotification.SERVER_REMOVED, identity, il)); } }.start();
InvokerLocator[] notif_locators = networkNotification.getLocator(); List<InvokerLocator> server_invokers = m_discoveredServers.get(networkNotification.getIdentity()); if (server_invokers == null) { server_invokers = new ArrayList<InvokerLocator>(networkNotification.getLocator().length); m_discoveredServers.put(networkNotification.getIdentity(), server_invokers);
/** * Receives notifications from the Network Registry indicating that servers are either coming on or offline. * * @see NotificationListener#handleNotification(javax.management.Notification, java.lang.Object) */ public void handleNotification(Notification notification, Object handback) { // check to see if it is a network registry notification if (notification instanceof NetworkNotification) { NetworkNotification networkNotification = (NetworkNotification) notification; String notifType = networkNotification.getType(); // check to see if notification is for new servers being added if (NetworkNotification.SERVER_ADDED.equals(notifType)) { discoveredNewServers(networkNotification); } else if (NetworkNotification.SERVER_REMOVED.equals(notifType)) { discoveredRemovedServers(networkNotification); } else if (NetworkNotification.SERVER_UPDATED.equals(notifType)) { discoveredUpdatedServers(networkNotification); } else if (NetworkNotification.DOMAIN_CHANGED.equals(notifType)) { discoveredChangedDomain(networkNotification); } else { getLog().warn(CommI18NResourceKeys.UNKNOWN_NOTIF_TYPE, notifType); } } else { getLog().warn(CommI18NResourceKeys.UNKNOWN_NOTIF, notification.getClass()); } return; }
public void run() { broadcaster.sendNotification(new NetworkNotification(objectName, NetworkNotification.DOMAIN_CHANGED, Identity.get(mBeanServer), InvokerRegistry.getRegisteredServerLocators())); } }.start();
List<InvokerLocator> new_invokers = new ArrayList<InvokerLocator>(); List<InvokerLocator> dead_invokers = new ArrayList<InvokerLocator>(); InvokerLocator[] notif_locators = networkNotification.getLocator(); List<InvokerLocator> server_invokers = m_discoveredServers.get(networkNotification.getIdentity());
List<InvokerLocator> new_invokers = new ArrayList<InvokerLocator>(); List<InvokerLocator> dead_invokers = new ArrayList<InvokerLocator>(); InvokerLocator[] notif_locators = networkNotification.getLocator(); List<InvokerLocator> server_invokers = m_discoveredServers.get(networkNotification.getIdentity());