Examples of JMXConnectionNotification


Examples of javax.management.remote.JMXConnectionNotification

        public void handleNotification(Notification notification, Object handback) {

            if (notification instanceof JMXConnectionNotification) {

                JMXConnectionNotification jn = (JMXConnectionNotification) notification;

                if (log.isLoggable(Level.FINE)) {
                    Subject sub = Subject.getSubject(AccessController.getContext());
                    log.log(Level.FINE, "Got notification from client {0}, subject = {1}", new Object[]{jn.getConnectionId(), sub});
                }

                long sessionId = getSessionIdFromConnectionId(jn.getConnectionId());
                if (sessionId >= 0) {
                    if (JMXConnectionNotification.CLOSED.equals(jn.getType())) {
                        log.log(Level.FINE, "client connection {0} closed", jn.getConnectionId());
                        JGDISession session = JGDISession.closeSession(sessionId);
                        if (session != null) {
                            unregisterSessionMBean(session);
                        }
                    } else if (JMXConnectionNotification.FAILED.equals(jn.getType())) {
                        log.log(Level.FINE, "client connection {0} failed", jn.getConnectionId());
                        JGDISession session = JGDISession.closeSession(sessionId);
                        if (session != null) {
                            unregisterSessionMBean(session);
                        }
                    } else if (JMXConnectionNotification.NOTIFS_LOST.equals(jn.getType())) {
                        log.log(Level.WARNING, "client connection {0} losts notification", jn.getConnectionId());
                    } else if (JMXConnectionNotification.OPENED.equals(jn.getType())) {
                        if (log.isLoggable(Level.FINE)) {
                            log.log(Level.FINE, "client connection {0} opened", new Object[]{jn.getConnectionId()});
                        }
                        JGDISession session = JGDISession.createNewSession(sessionId, url);
                        registerSessionMBean(session);
                    }
                } else {
                    log.log(Level.WARNING, "Got a jmx connection without a session id: {0}", jn.getConnectionId());
                }
            }
        }
View Full Code Here

Examples of javax.management.remote.JMXConnectionNotification

      }
   }

   public void sendConnectionNotificationOpened()
   {
      JMXConnectionNotification notification = new JMXConnectionNotification(JMXConnectionNotification.OPENED, connector, getConnectionId(), getNextNotificationNumber(), "Connection opened", null);
      sendNotification(notification);
   }
View Full Code Here

Examples of javax.management.remote.JMXConnectionNotification

      sendNotification(notification);
   }

   public void sendConnectionNotificationClosed()
   {
      JMXConnectionNotification notification = new JMXConnectionNotification(JMXConnectionNotification.CLOSED, connector, getConnectionId(), getNextNotificationNumber(), "Connection closed", null);
      sendNotification(notification);
   }
View Full Code Here

Examples of javax.management.remote.JMXConnectionNotification

      sendNotification(notification);
   }

   public void sendConnectionNotificationFailed()
   {
      JMXConnectionNotification notification = new JMXConnectionNotification(JMXConnectionNotification.FAILED, connector, getConnectionId(), getNextNotificationNumber(), "Connection failed", null);
      sendNotification(notification);
   }
View Full Code Here

Examples of javax.management.remote.JMXConnectionNotification

      sendNotification(notification);
   }

   public void sendConnectionNotificationLost(long howMany)
   {
      JMXConnectionNotification notification = new JMXConnectionNotification(JMXConnectionNotification.NOTIFS_LOST, connector, getConnectionId(), getNextNotificationNumber(), "Some notification (" + howMany + ") was lost", null);
      sendNotification(notification);
   }
View Full Code Here

Examples of javax.management.remote.JMXConnectionNotification

    // This handler relies on the "message" field of the notification to extract the information
    public void handleNotification(Notification notification, Object obj) {
        // handle JMX connection status notification
        if (notification instanceof JMXConnectionNotification) {
            JMXConnectionNotification jmxcNotification = (JMXConnectionNotification) notification;
            if (jmxcNotification.getType().equals(JMXConnectionNotification.FAILED)) {
                logger.error("JMX connection to " + componentName + " (" + jmxcNotification.getConnectionId() + ") has been lost !\n" + jmxcNotification.getMessage());
                propertiesHistory.signalPossibleNotificationLoss();
            } else if (jmxcNotification.getType().equals(JMXConnectionNotification.NOTIFS_LOST)) {
                logger.error("JMX connection to " + componentName + " (" + jmxcNotification.getConnectionId() + ") could have lost some notifications:\n" + jmxcNotification.getMessage());
                /*
                 if (jmxcNotification.getUserData() instanceof Long) {
                    lastNotificationSequenceNumber += (Long)jmxcNotification.getUserData();
                }*/
                propertiesHistory.signalPossibleNotificationLoss();
View Full Code Here

Examples of javax.management.remote.JMXConnectionNotification

        }
    }

    public void handleNotification(Notification notification, Object o) {
        if (notification instanceof JMXConnectionNotification) {
            JMXConnectionNotification cxNotification = (JMXConnectionNotification) notification;
            String type = cxNotification.getType();
            String connectionId = cxNotification.getConnectionId();
            if (JMXConnectionNotification.OPENED.equals(type)) {
                LoginContext context = threadContext.get();
                threadContext.set(null);
                contextMap.put(connectionId, context);
            } else {
View Full Code Here

Examples of javax.management.remote.JMXConnectionNotification

            // reconnecting, to identify the "old" connection.
            //
            connectionId = getConnectionId();

            Notification connectedNotif =
                    new JMXConnectionNotification(JMXConnectionNotification.OPENED,
                    this,
                    connectionId,
                    clientNotifSeqNo++,
                    "Successful connection",
                    null);
View Full Code Here

Examples of javax.management.remote.JMXConnectionNotification

         * never called connect() on the connector, because there's no
         * connection id in that case.  */

        if (savedConnectionId != null) {
            Notification closedNotif =
                    new JMXConnectionNotification(JMXConnectionNotification.CLOSED,
                    this,
                    savedConnectionId,
                    clientNotifSeqNo++,
                    "Client has been closed",
                    null);
View Full Code Here

Examples of javax.management.remote.JMXConnectionNotification

        }

        protected void lostNotifs(String message, long number) {
            final String notifType = JMXConnectionNotification.NOTIFS_LOST;

            final JMXConnectionNotification n =
                new JMXConnectionNotification(notifType,
                                              RMIConnector.this,
                                              connectionId,
                                              clientNotifCounter++,
                                              message,
                                              Long.valueOf(number));
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.