Examples of NetworkNotification


Examples of org.jboss.remoting.network.NetworkNotification

    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;
View Full Code Here

Examples of org.jboss.remoting.network.NetworkNotification

     * @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)) {
View Full Code Here

Examples of org.jboss.remoting.network.NetworkNotification

            }
            return;
         }
         else if(notification instanceof NetworkNotification)
         {
            NetworkNotification nn = (NetworkNotification) notification;
            String type = nn.getType();
            if(type.equals(NetworkNotification.SERVER_ADDED))
            {
               // found a server
               Identity ident = nn.getIdentity();
               MBeanServerLocator l = new MBeanServerLocator(ident);
               foundMBeanServer(l);
            }
            else if(type.equals(NetworkNotification.SERVER_REMOVED))
            {
               // lost a server
               Identity ident = nn.getIdentity();
               MBeanServerLocator l = new MBeanServerLocator(ident);
               lostMBeanServer(l);
            }
            return;
         }
View Full Code Here

Examples of org.jboss.remoting.network.NetworkNotification

      {
         String type = notification.getType();
         if(type.equals(NetworkNotification.SERVER_REMOVED))
         {
            // server has failed
            NetworkNotification nn = (NetworkNotification) notification;
            String sessionId = nn.getIdentity().getJMXId();
            List failed = new ArrayList();
            synchronized(listeners)
            {
               Iterator iter = listeners.iterator();
               while(iter.hasNext())
               {
                  Listener listener = (Listener) iter.next();
                  if(sessionId.equals(listener.sessionId))
                  {
                     // just put into a list, so we only sync min time
                     failed.add(listener);
                  }
               }
            }
            if(failed.isEmpty() == false)
            {
               // walk through and remove each listener that has failed
               Iterator iter = failed.iterator();
               while(iter.hasNext())
               {
                  Listener listener = (Listener) iter.next();
                  if(log.isTraceEnabled())
                  {
                     log.trace("++ Removed orphaned listener because server failed: " + nn.getIdentity());
                  }
                  try
                  {
                     removeNotificationListener(listener.locator, listener.sessionId, listener.objectName, listener.handback);
                  }
View Full Code Here

Examples of org.jboss.remoting.network.NetworkNotification

      // check to see if network notification
      if(notification instanceof NetworkNotification)
      {
         println("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
            println("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
               {
                  // get the new found server's locator and invoke a call
                  InvokerLocator newServerLocator = locators[x];
                  makeInvocation(newServerLocator.getLocatorURI());
               }
               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++)
            {
               println("It has been detected that a server has gone down with a locator of: " + locators[x]);
            }
         }
View Full Code Here

Examples of org.jboss.remoting.network.NetworkNotification

   public void handleNotification(Notification notification, Object handback)
   {

      if (notification instanceof NetworkNotification)
      {
         NetworkNotification networkNotification = (NetworkNotification) notification;

         if (NetworkNotification.SERVER_ADDED.equals(networkNotification.getType()))
         { // notification is for new servers being added
            InvokerLocator[] locators = networkNotification.getLocator();
            for (int x = 0; x < locators.length; x++)
            {
               try
               {
                  //for this test make sure it's not a client
                  if (networkNotification.getLocator()[x].getPort() == 1001)
                  {
                     System.out.println("-+-Discovered server '" + locators[x].getLocatorURI() + "'-+-");
                     init(locators[x]);
                  }
               }
               catch (Exception ignored)
               {
               }
            }

         }
         else if (NetworkNotification.SERVER_REMOVED.equals(networkNotification.getType()))
         { // notification

            InvokerLocator[] locators = networkNotification.getLocator();
            for (int x = 0; x < locators.length; x++)
            {

               try
               {
                  //for this test make sure it's not a client
                  if (networkNotification.getLocator()[x].getPort() == 1001)
                  {
                     System.out.println("-!-Server '" + locators[x].getLocatorURI() + "' has gone-!-");
                  }
               }
               catch (Throwable throwable)
View Full Code Here

Examples of org.jboss.remoting.network.NetworkNotification

   public void handleNotification(Notification notification, Object handback)
   {

      if (notification instanceof NetworkNotification)
      {
         NetworkNotification networkNotification = (NetworkNotification) notification;

         if (NetworkNotification.SERVER_ADDED.equals(networkNotification.getType()))
         { // notification is for new servers being added
            InvokerLocator[] locators = networkNotification.getLocator();
            for (int x = 0; x < locators.length; x++)
            {
               try
               {
                  //for this test make sure it's not a client
                  if (networkNotification.getLocator()[x].getPort() == 3001)
                  {
                     System.out.println("-+-Discovered server '" + locators[x].getLocatorURI() + "'-+-");
                     init(locators[x]);
                     detectionCount++;
                  }
               }
               catch (Exception ignored)
               {
               }
            }

         }
         else if (NetworkNotification.SERVER_REMOVED.equals(networkNotification.getType()))
         { // notification

            InvokerLocator[] locators = networkNotification.getLocator();
            for (int x = 0; x < locators.length; x++)
            {

               try
               {
                  //for this test make sure it's not a client
                  if (networkNotification.getLocator()[x].getPort() == 3001)
                  {
                     System.out.println("-!-Server '" + locators[x].getLocatorURI() + "' has gone-!-");
                     detectionFailureCount++;
                  }
               }
View Full Code Here

Examples of org.jboss.remoting.network.NetworkNotification

   public void handleNotification(Notification notification, Object handback)
   {

      if (notification instanceof NetworkNotification)
      {
         NetworkNotification networkNotification = (NetworkNotification) notification;

         if (NetworkNotification.SERVER_ADDED.equals(networkNotification.getType()))
         { // notification is for new servers being added
            InvokerLocator[] locators = networkNotification.getLocator();
            for (int x = 0; x < locators.length; x++)
            {
               try
               {
                  //for this test make sure it's not a client
                  if (networkNotification.getLocator()[x].getPort() == 1001)
                  {
                     System.out.println("-+-Discovered server '" + locators[x].getLocatorURI() + "'-+-");
                     init(locators[x]);
                  }
               }
               catch (Exception ignored)
               {
               }
            }

         }
         else if (NetworkNotification.SERVER_REMOVED.equals(networkNotification.getType()))
         { // notification

            InvokerLocator[] locators = networkNotification.getLocator();
            for (int x = 0; x < locators.length; x++)
            {

               try
               {
                  //for this test make sure it's not a client
                  if (networkNotification.getLocator()[x].getPort() == 1001)
                  {
                     System.out.println("-!-Server '" + locators[x].getLocatorURI() + "' has gone-!-");
                  }
               }
               catch (Throwable throwable)
View Full Code Here

Examples of org.jboss.remoting.network.NetworkNotification

   public void handleNotification(Notification notification, Object o)
   {
      System.out.println("Received notification: " + notification);
      if (notification instanceof NetworkNotification)
      {
         NetworkNotification netNot = (NetworkNotification) notification;
         if(NetworkNotification.SERVER_ADDED.equals(netNot.getType()))
         {
            numOfAdded = netNot.getLocator().length;
            //System.out.println("server added.  num of locators added = " + numOfAdded);
         }
         else if(NetworkNotification.SERVER_UPDATED.equals(netNot.getType()))
         {
            numOfUpdated = netNot.getLocator().length;
            //System.out.println("server updated.  num of locators in update = " + numOfAdded);
         }
         ServerInvokerMetadata[] serverMetadata = netNot.getServerInvokers();
         System.out.println(netNot.getIdentity());
         System.out.println(serverMetadata);
         InvokerLocator[] locators = netNot.getLocator();
         if (locators != null)
         {
            for (int x = 0; x < locators.length; x++)
            {
               System.out.println(locators[x]);
View Full Code Here

Examples of org.jboss.remoting.network.NetworkNotification

         // 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]);
               }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.