Package javax.management

Examples of javax.management.MBeanServerNotification


    }

    public void handleNotification(final Notification notifIn, final Object handback) {
        if ((notifIn instanceof MBeanServerNotification) &&
                notifIn.getType().equals(MBeanServerNotification.REGISTRATION_NOTIFICATION)) {
            final MBeanServerNotification notif = (MBeanServerNotification) notifIn;
            final ObjectName objectName = notif.getMBeanName();
            if (objectName.getDomain().equals(mDomainRoot.objectName().getDomain())) {
                validate(objectName);
            }
        }
    }


                    "Type not selected, exiting");
            return false;
        }

        // We have a MBeanServerNotification: downcasts it
        MBeanServerNotification mbsNtf = (MBeanServerNotification)notif;

        // Checks the ObjectName
        ObjectName objName = mbsNtf.getMBeanName();
        // Is it selected?
        boolean isSelectedFlg = false;
        if (selectedNames != null) {
            // Not all are implicitly selected:
            // checks for explicit selection

                        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;

        // ------------------------------

        // ---------------------
        // Create notification
        // ---------------------
        MBeanServerNotification notif = new MBeanServerNotification(
            NotifType,MBeanServerDelegate.DELEGATE_NAME,0,name);

        if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
            MBEANSERVER_LOGGER.logp(Level.FINER,
                    DefaultMBeanServerInterceptor.class.getName(),

                if (idaf.id == id) {
                    // This is a notification from the MBeanServerDelegate.
                    Notification n = tn.getNotification();
                    if (n instanceof MBeanServerNotification &&
                            n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
                        MBeanServerNotification mbsn = (MBeanServerNotification) n;
                        ObjectName gone = mbsn.getMBeanName();
                        synchronized (listenerMap) {
                            listenerMap.remove(gone);
                        }
                    }
                }

            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 ) )
                {
                    ImplUtil.getLogger().fine("New ResourceRef MBEAN registered: " + objectName);
                    final ResourceRef ref = mProxyFactory.getProxy(objectName, ResourceRef.class);
                    processResourceRef(ref);
                }
                else if ( type.equals( mApplicationRefType ) )
                {
                    ImplUtil.getLogger().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);

        RELATION_LOGGER.entering(RelationService.class.getName(),
                "handleNotification", notif);

        if (notif instanceof MBeanServerNotification) {

            MBeanServerNotification mbsNtf = (MBeanServerNotification) notif;
            String ntfType = notif.getType();

            if (ntfType.equals(
                       MBeanServerNotification.UNREGISTRATION_NOTIFICATION )) {
                ObjectName mbeanName =

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

        n.setTimeStamp(mTimestamp);
        sendNotification(n);
    }

    public void triggerMBeanServerNotification() throws Exception {
        MBeanServerNotification n = new MBeanServerNotification("mbeanserver", this, mSequence++, new ObjectName("TestDomain", "name", "foo"));
        n.setTimeStamp(mTimestamp);
        sendNotification(n);
    }

        n.setTimeStamp(mTimestamp);
        sendNotification(n);
    }

    public void triggerMBeanServerNotification() throws Exception {
        MBeanServerNotification n = new MBeanServerNotification("mbeanserver", this, mSequence++, new ObjectName("TestDomain", "name", "foo"));
        n.setTimeStamp(mTimestamp);
        sendNotification(n);
    }

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.