Package javax.management.remote

Examples of javax.management.remote.JMXConnectionNotification


     */
    private class ConnectionNotificationListener implements NotificationListener {

        @Override
        public void handleNotification(Notification notification, Object handback) {
            JMXConnectionNotification connectionNotification = (JMXConnectionNotification)notification;
            // only reset the connection if the notification is for the connection from this endpoint
            if (!connectionNotification.getConnectionId().equals(mConnectionId)) {
                return;
            }
            if (connectionNotification.getType().equals(JMXConnectionNotification.NOTIFS_LOST)
                        || connectionNotification.getType().equals(JMXConnectionNotification.CLOSED)
                        || connectionNotification.getType().equals(JMXConnectionNotification.FAILED)) {
                LOG.warn("Lost JMX connection for : {}", URISupport.sanitizeUri(mJmxEndpoint.getEndpointUri()));
                if (mJmxEndpoint.getReconnectOnConnectionFailure()) {
                    scheduleReconnect();
                } else {
                    LOG.warn("The JMX consumer will not be reconnected.  Use 'reconnectOnConnectionFailure' to "
View Full Code Here


    public void handleNotification(final Notification notif, final Object handback)
    {
        if (notif instanceof JMXConnectionNotification)
        {
            final JMXConnectionNotification n = (JMXConnectionNotification) notif;
            if (n.getType().equals(JMXConnectionNotification.OPENED))
            {
                Util.getLogger().info("BootAMXListener: connection made for " + handback + ", booting AMX MBeans");
                mBooter.bootAMX();

                // job is done, stop listening
View Full Code Here

        }
    }

    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 = (LoginContext) threadContext.get();
                threadContext.set(null);
                contextMap.put(connectionId, context);
            } else {
View Full Code Here

        connector=c;
        connection = null;
    }

    connectionId = c.getConnectionId();
    JMXConnectionNotification notif =
        new JMXConnectionNotification("jmx.remote.connection.open",
              "",
              connectionId,
              0,
              "",
              "");
    broadcaster.sendNotification(notif);
    return;
      }catch(Exception e) {
    //e.printStackTrace();
    try {
        Thread.sleep(period);
    }catch(Exception ex) {}
      }
      currentTime =  System.currentTimeMillis();
  }while(((currentTime - startTime) < envelopTime) && !stop);
 
  if(!stop) {
      if(currentConnectionId == null)
    currentConnectionId = "NeverConnectedConnection";
     
      JMXConnectionNotification notif =
    new JMXConnectionNotification("jmx.remote.connection.failed",
                "",
                currentConnectionId,
                0,
                "",
                "");
View Full Code Here

  } catch (Exception x) {
      unexpectedException(nt,null,x);
  }
  final String connectionId =
      ((JMXConnectionNotification)n).getConnectionId();
  final JMXConnectionNotification newn =
      new JMXConnectionNotification(nt,this,connectionId,
            newSequenceNumber(), n.getMessage(),
            n.getUserData());
  sendNotification(newn);
    }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public void handleNotification(Notification notif, Object handback)
  {
    JMXConnectionNotification jcn ;

    //
    // We don't have the expected notification
    if ( ! (notif instanceof JMXConnectionNotification))
    {
      return ;
    }
    else
    {
      jcn = (JMXConnectionNotification) notif ;
    }

    //
    // The only handled notifications are CLOSED and FAILED
    if (! (
        (jcn.getType().equals(JMXConnectionNotification.CLOSED))
        ||
        (jcn.getType().equals(JMXConnectionNotification.FAILED))
        ))
    {
      return;
    }

    //
    // Check if the closed connection corresponds to the current connection
    if (!(jcn.getConnectionId().equals(jmxConnectionID)))
    {
      return;
    }

    //
View Full Code Here

      }
  }

  protected void lostNotifs(String message, long number) {
      final String notifType = JMXConnectionNotification.NOTIFS_LOST;
      final JMXConnectionNotification n =
    new JMXConnectionNotification(notifType,
                ClientIntermediary.this,
                connection.getConnectionId(),
                lostNotifCounter++,
                message,
                new Long(number));
View Full Code Here

      if (tracing) logger.trace("connect",idstr+" "+connectionId+" Connected.");
  }

  notifThread = new ThreadService(0, 1);

  sendNotification(new JMXConnectionNotification(
       JMXConnectionNotification.OPENED,
       this,
       connectionId,
       clientNotifID++,
       null,
View Full Code Here

      rmbscMap.clear();
  }

  // if not connected, no need to send closed notif
  if (!createdState) {
      sendNotification(new JMXConnectionNotification(
          JMXConnectionNotification.CLOSED,
          this,
          connectionId,
          clientNotifID++,
          "The client has been closed.", null));
View Full Code Here

    throw new IOException(
       "The connector is not at the connection state.");
      }
  }

  sendNotification(new JMXConnectionNotification(
       JMXConnectionNotification.FAILED,
       this,
       connectionId,
       clientNotifID++,
       "The client has got connection exception.", null));

  connection.connect(env);
  connectionId = connection.getConnectionId();

  sendNotification(new JMXConnectionNotification(
          JMXConnectionNotification.OPENED,
          this,
          connectionId,
          clientNotifID++,
          "The client has succesfully reconnected to the server.", null));
View Full Code Here

TOP

Related Classes of javax.management.remote.JMXConnectionNotification

Copyright © 2018 www.massapicom. 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.