Package javax.management

Examples of javax.management.MBeanServerNotification


        }

        if (notif instanceof MBeanServerNotification)
        {
            // this should really be done in a MBeanServerNotificationStringifier!
            final MBeanServerNotification n = (MBeanServerNotification) notif;

            append(b, StringUtil.quote(n.getMBeanName()));
        }

        return (b);
    }


                final Notification notifIn,
                final Object handback)
        {
            if (notifIn instanceof MBeanServerNotification)
            {
                final MBeanServerNotification notif = (MBeanServerNotification) notifIn;

                final ObjectName objectName = notif.getMBeanName();
                final String type = notif.getType();

                try
                {
                    if (type.equals(MBeanServerNotification.REGISTRATION_NOTIFICATION))
                    {

        if (!(notifIn instanceof MBeanServerNotification))
        {
            throw new IllegalArgumentException(notifIn.toString());
        }

        final MBeanServerNotification notif = (MBeanServerNotification) notifIn;
        final ObjectName objectName = notif.getMBeanName();
        final String type = notif.getType();

        final boolean matchesFilter = (mRegUnregFilter == null) ||
                                      JMXUtil.matchesPattern(mDefaultDomain, mRegUnregFilter, objectName);

        if (matchesFilter)

    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);

            if (!(notifIn instanceof MBeanServerNotification))
            {
                return;
            }

            final MBeanServerNotification notif = (MBeanServerNotification) notifIn;
            final ObjectName objectName = notif.getMBeanName();
            if ( ! mJ2EEServer.objectName().getDomain().equals(objectName.getDomain()))
            {
                return;
            }
           
            final String type = Util.getTypeProp(objectName);

            if (notif.getType().equals(MBeanServerNotification.REGISTRATION_NOTIFICATION))
            {
                if ( type.equals( mResourceRefType ) )
                {
                    mLogger.fine("New ResourceRef MBEAN registered: " + objectName);
                    final ResourceRef ref = mProxyFactory.getProxy(objectName, ResourceRef.class);
                    processResourceRef(ref);
                }
                else if ( type.equals( mApplicationRefType ) )
                {
                    mLogger.fine( "NEW ApplicationRef MBEAN registered: " + objectName);
                    final ApplicationRef ref = mProxyFactory.getProxy(objectName, ApplicationRef.class);
                    processApplicationRef(ref);
                }
            }
            else if (notif.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION))
            {
                // determine if it's a config for which a JSR 77  MBean is registered
                synchronized (mConfigRefTo77)
                {
                    final ObjectName mbean77 = mConfigRefTo77.remove(objectName);

     * @see NotificationListener#handleNotification
     **/
    protected void handleMBeanServerNotification(Notification notification,
            Object handback) {
  if (notification instanceof MBeanServerNotification) {
      final MBeanServerNotification n =
    (MBeanServerNotification) notification;
      final String nt = notification.getType();
      final ObjectName sourceName = n.getMBeanName();
      if (MBeanServerNotification.REGISTRATION_NOTIFICATION.
    equals(nt)) {
    if (mustCascade(sourceName)) {
        showMBean(nt,sourceName);
    }

   * @param notification received
   * @param handback The handback
   */
  public void handleNotification(Notification notification, Object handback) {
    if (notification instanceof MBeanServerNotification) {
      MBeanServerNotification notif = (MBeanServerNotification) notification;
      // Process the ConnectionHandler Registration
      if (notif.getType().equals(
              MBeanServerNotification.REGISTRATION_NOTIFICATION)) {
        ObjectName name = notif.getMBeanName();
        if ((name.getKeyProperty("Rdn1").equals("cn-monitor")) &&
                (isAConnectionHandler(name))) {
          addRowInDsApplIfOpsTable(name);
        }
      }
      // Process the ConnectionHandler unregistration
      else if (notif.getType().equals(
              MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
        ObjectName name = notif.getMBeanName();
        if ((name.getKeyProperty("Rdn1").equals("cn-monitor")) &&
                (isAConnectionHandler(name))) {
          removeRowInDsApplIfOpsTable(name);
        }
      }

     */
    protected void sendRegistrationNotification (ObjectName regName)
    {
        long sequence = registrationNotificationSequence.increment ();
        delegate.sendNotification (
                new MBeanServerNotification (
                        MBeanServerNotification.REGISTRATION_NOTIFICATION,
                        delegate, sequence, regName));
    }

  protected void sendUnRegistrationNotification (ObjectName name)
  {
      long sequence = unregistrationNotificationSequence.increment ();

      delegate.sendNotification (
              new MBeanServerNotification (
                      MBeanServerNotification.UNREGISTRATION_NOTIFICATION,
                      delegate,
                      sequence,
                      name
              )

      final String unreg =
          MBeanServerNotification.UNREGISTRATION_NOTIFICATION;
      if (notif instanceof MBeanServerNotification &&
          notif.getType().equals(unreg)) {
         
          MBeanServerNotification mbsn =
        (MBeanServerNotification) notif;
          ObjectName name = mbsn.getMBeanName();
         
          removeNotificationListener(name);
      }
        }
        myListenerID = mbeanRemovedNotifID;

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.