Package javax.management

Examples of javax.management.MBeanServerNotification


      //Should be a mbean registration notification due to RegistrationNotificationFilter being used.
      if (notification instanceof MBeanServerNotification)
      {
         if (notification.getType().equals(MBeanServerNotification.REGISTRATION_NOTIFICATION))
         {
            MBeanServerNotification serverNotification = (MBeanServerNotification) notification;
            try
            {
               mbeanRegistered(serverNotification.getMBeanName());
            }
            catch (Exception e)
            {
               log.error("Error configuring mbean " + serverNotification.getMBeanName(), e);
            }
         }
      }

   }


      {
         sequenceNumber = notifications;
         ++notifications;
      }

      delegate.sendNotification(new MBeanServerNotification(notificationType, delegateName, sequenceNumber, objectName));
   }

   
  }
  @Override
  public void handleNotification(Notification notification, Object handback)
  {
    MBeanServerNotification mbs = (MBeanServerNotification) notification;
    if(MBeanServerNotification.REGISTRATION_NOTIFICATION.equals(mbs.getType()))
    {
      //System.out.println("Adding mbean " + mbs.getMBeanName());
      _logger.info("Adding mbean " + mbs.getMBeanName());
      if(mbs.getMBeanName().getDomain().equalsIgnoreCase(_domain))
      {
        addMBean( mbs.getMBeanName());
      }
    }
    else if(MBeanServerNotification.UNREGISTRATION_NOTIFICATION.equals(mbs.getType()))
    {
      //System.out.println("Removing mbean " + mbs.getMBeanName());
      _logger.info("Removing mbean " + mbs.getMBeanName());
      if(mbs.getMBeanName().getDomain().equalsIgnoreCase(_domain))
      {
        removeMBean(mbs.getMBeanName());
      }
    }
  }

    _server.addNotificationListener(MBeanServerDelegate.DELEGATE_NAME, this, filter, null);
  }
 
  public void handleNotification(Notification notification, Object handback)
  {
    MBeanServerNotification mbs = (MBeanServerNotification) notification;
    if(MBeanServerNotification.REGISTRATION_NOTIFICATION.equals(mbs.getType()))
    {
      if(mbs.getMBeanName().getDomain().equalsIgnoreCase(_domain))
      {
        _logger.info("MBean Registered, name :" + mbs.getMBeanName());
        onMBeanRegistered(_server, mbs);
      }
    }
    else if(MBeanServerNotification.UNREGISTRATION_NOTIFICATION.equals(mbs.getType()))
    {
      if(mbs.getMBeanName().getDomain().equalsIgnoreCase(_domain))
      {
        _logger.info("MBean Unregistered, name :" + mbs.getMBeanName());
        onMBeanUnRegistered(_server, mbs);
      }
    }
  }

    public void handleNotification(Notification notification, Object handback)
    {
        // register/unregister mbeans in jndi
        if( notification instanceof MBeanServerNotification ) {
            MBeanServerNotification msnot=(MBeanServerNotification)notification;

            ObjectName oname=msnot.getMBeanName();

            if( "jmx.mbean.created".equalsIgnoreCase( notification.getType() )) {
                try {
                    Object mbean=mserver.getObjectInstance(oname);

    public void handleNotification(Notification notification, Object handback)
    {
        // register/unregister mbeans in jndi
        if( notification instanceof MBeanServerNotification ) {
            MBeanServerNotification msnot=(MBeanServerNotification)notification;

            ObjectName oname=msnot.getMBeanName();

            if( "jmx.mbean.created".equalsIgnoreCase( notification.getType() )) {
                try {
                    Object mbean=mserver.getObjectInstance(oname);

    filter.enableAllObjectNames();
    _server.addNotificationListener(MBeanServerDelegate.DELEGATE_NAME, this, filter, null);
  }

  public void handleNotification(Notification notification, Object handback) {
    MBeanServerNotification mbs = (MBeanServerNotification) notification;
    if (MBeanServerNotification.REGISTRATION_NOTIFICATION.equals(mbs.getType())) {
      if (mbs.getMBeanName().getDomain().equalsIgnoreCase(_domain)) {
        _logger.info("MBean Registered, name :" + mbs.getMBeanName());
        onMBeanRegistered(_server, mbs);
      }
    } else if (MBeanServerNotification.UNREGISTRATION_NOTIFICATION.equals(mbs.getType())) {
      if (mbs.getMBeanName().getDomain().equalsIgnoreCase(_domain)) {
        _logger.info("MBean Unregistered, name :" + mbs.getMBeanName());
        onMBeanUnRegistered(_server, mbs);
      }
    }
  }

    }
  }

  @Override
  public void handleNotification(Notification notification, Object handback) {
    MBeanServerNotification mbs = (MBeanServerNotification) notification;
    if (MBeanServerNotification.REGISTRATION_NOTIFICATION.equals(mbs.getType())) {
      // System.out.println("Adding mbean " + mbs.getMBeanName());
      _logger.info("Adding mbean " + mbs.getMBeanName());
      if (mbs.getMBeanName().getDomain().equalsIgnoreCase(_domain)) {
        addMBean(mbs.getMBeanName());
      }
    } else if (MBeanServerNotification.UNREGISTRATION_NOTIFICATION.equals(mbs.getType())) {
      // System.out.println("Removing mbean " + mbs.getMBeanName());
      _logger.info("Removing mbean " + mbs.getMBeanName());
      if (mbs.getMBeanName().getDomain().equalsIgnoreCase(_domain)) {
        removeMBean(mbs.getMBeanName());
      }
    }
  }

    // Check the notification type
    if (super.isNotificationEnabled(notification) == false)
      return false;

    // Get the object name
    MBeanServerNotification mbsNotification = (MBeanServerNotification) notification;
    ObjectName objectName = mbsNotification.getMBeanName();

    // Is it enabled?
    if (enabled != null)
      return enabled.contains(objectName);

    {
        Object src = notification.getSource();
        ObjectName on = null;
        if (notification instanceof MBeanServerNotification)
        {
            MBeanServerNotification mb = (MBeanServerNotification) notification;
            on = mb.getMBeanName();
        }
        else if (src instanceof ObjectName)
        {
            on = (ObjectName) src;
        }

TOP

Related Classes of javax.management.MBeanServerNotification

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.