Examples of MBeanServerNotificationFilter


Examples of javax.management.relation.MBeanServerNotificationFilter

 
        mObjectNameToConfigBean  = Collections.synchronizedMap( new HashMap<ObjectName,ConfigBean>() );
       
    loadSystemInfo( server );
     
    final MBeanServerNotificationFilter filter  =
      new MBeanServerNotificationFilter();
        filter.enableAllObjectNames();
    JMXUtil.listenToMBeanServerDelegate( mServer, this, filter, null );
    }
View Full Code Here

Examples of javax.management.relation.MBeanServerNotificationFilter

   
    try
    {
      loadSystemInfo( server );
     
      final MBeanServerNotificationFilter filter  =
        new MBeanServerNotificationFilter();

            filter.enableAllObjectNames();
           
            if ( mServer != server )
            {
                throw new IllegalStateException();
            }
View Full Code Here

Examples of javax.management.relation.MBeanServerNotificationFilter

         {
         }

         // Everything is serializable
         ObjectName name = ObjectName.getInstance(":mbean=dummy");
         MBeanServerNotificationFilter filter = new MBeanServerNotificationFilter();
         filter.disableObjectName(name);
         Object handback = new Integer(13);
         mbsc.addNotificationListener(emitterName, listenerName, filter, handback);

         // Wait for notifications threads to start
         sleep(1000);

         Notification notification = new MBeanServerNotification(MBeanServerNotification.REGISTRATION_NOTIFICATION, this, 0, name);
         emitter.emit(notification);

         // Wait for notification to arrive
         sleep(1000);

         // Be sure the notification has been filtered
         assertNull(notificationHolder.get());
         assertNull(handbackHolder.get());

         // Disable filtering
         filter.enableAllObjectNames();
         // Remove and readd: on server side there is a serialized copy of the filter
         mbsc.removeNotificationListener(emitterName, listenerName);
         mbsc.addNotificationListener(emitterName, listenerName, filter, handback);

         // Wait for notifications threads to start
View Full Code Here

Examples of javax.management.relation.MBeanServerNotificationFilter

   public void compareMBeanServerNotificationFilter(Object o1, Object o2)
   {
      compareNotificationFilterSupport(o1, o2);

      MBeanServerNotificationFilter f1 = (MBeanServerNotificationFilter)o1;
      MBeanServerNotificationFilter f2 = (MBeanServerNotificationFilter)o2;
      Vector names1 = null;
      try
      {
         names1 = f1.getEnabledObjectNames();
      }
      catch (NullPointerException ignored)
      {
         // JMX RI throws this
      }
      Vector names2 = null;
      try
      {
         names2 = f2.getEnabledObjectNames();
      }
      catch (NullPointerException ignored)
      {
         // JMX RI throws this
      }
View Full Code Here

Examples of javax.management.relation.MBeanServerNotificationFilter

     
      // we should always be able to listen to MBeans--
      // but the http connector does not support listeners
      try
      {
        final MBeanServerNotificationFilter  filter  = new MBeanServerNotificationFilter();
        filter.enableAllObjectNames();
        filter.disableAllTypes();
        filter.enableType( MBeanServerNotification.UNREGISTRATION_NOTIFICATION );
        JMXUtil.listenToMBeanServerDelegate( conn, this, filter, null );
      }
      catch( Exception e )
      {
        warning( "ProxyFactory: connection does not support notifications: ",
View Full Code Here

Examples of javax.management.relation.MBeanServerNotificationFilter

  public ClusterMBeanObserver(String domain) throws InstanceNotFoundException, IOException,
      MalformedObjectNameException, NullPointerException {
    // Get a reference to the target MBeanServer
    _domain = domain;
    _server = ManagementFactory.getPlatformMBeanServer();
    MBeanServerNotificationFilter filter = new MBeanServerNotificationFilter();
    filter.enableAllObjectNames();
    _server.addNotificationListener(MBeanServerDelegate.DELEGATE_NAME, this, filter, null);
  }
View Full Code Here

Examples of javax.management.relation.MBeanServerNotificationFilter

      }
    }
  }

  public void disconnect() {
    MBeanServerNotificationFilter filter = new MBeanServerNotificationFilter();
    try {
      _server.removeNotificationListener(MBeanServerDelegate.DELEGATE_NAME, this);
    } catch (Exception e) {
      _logger.error("", e);
    }
View Full Code Here

Examples of javax.management.relation.MBeanServerNotificationFilter

     * @param pListener listener to register
     * @param pObjectNameToFilter object name which should be listen for. If null, listens for any MBean registration
     */
    public static void addMBeanRegistrationListener(MBeanServerConnection pServer, NotificationListener pListener,
                                                    ObjectName pObjectNameToFilter) {
        MBeanServerNotificationFilter filter = new MBeanServerNotificationFilter();
        if (pObjectNameToFilter == null) {
            filter.enableAllObjectNames();
        } else {
            filter.enableObjectName(pObjectNameToFilter);
        }
        try {
            pServer.addNotificationListener(getMBeanServerDelegateName(), pListener, filter, null);
        } catch (InstanceNotFoundException e) {
            throw new IllegalStateException("Cannot find " + getMBeanServerDelegateName() + " in server " + pServer,e);
View Full Code Here

Examples of javax.management.relation.MBeanServerNotificationFilter

            mDomainRoot = getProxy(mDomainRootObjectName, DomainRoot.class);

            // we should always be able to listen to MBeans--
            // but the http connector does not support listeners
            try {
                final MBeanServerNotificationFilter filter = new MBeanServerNotificationFilter();
                filter.enableAllObjectNames();
                filter.disableAllTypes();
                filter.enableType(MBeanServerNotification.UNREGISTRATION_NOTIFICATION);
                JMXUtil.listenToMBeanServerDelegate(conn, this, filter, null);
            } catch (Exception e) {
                warning("ProxyFactory: connection does not support notifications: ",
                        mMBeanServerID, conn);
            }
View Full Code Here

Examples of javax.management.relation.MBeanServerNotificationFilter

    */
   public NotificationFilter createNotificationFilter(Element filterConfig)
      throws Exception
   {
      // start off with a filter that does not allow any type/objectname
      MBeanServerNotificationFilter filter = new MBeanServerNotificationFilter();
     
      // filterConfig should point to the <filter factory="..."> element,
      // we are interested in its 'enable' children to configure the filter
      NodeList filterChildren = filterConfig.getChildNodes();
     
      for (int i = 0; i < filterChildren.getLength(); i++)
      {
         Node filterChildNode = filterChildren.item(i);
     
         // check if this is an 'enable' element, ignore everything else
         if (filterChildNode.getNodeName().equals(ENABLE_ELEMENT))
         {
            // look for 'type' attribute
            if (((Element)filterChildNode).hasAttribute(ENABLE_TYPE_ATTRIBUTE))
            {
               String type = ((Element)filterChildNode).getAttribute(ENABLE_TYPE_ATTRIBUTE);
               // enable this type in the filter
               filter.enableType(type);
            }
            else if (((Element)filterChildNode).hasAttribute(ENABLE_OBJECTNAME_ATTRIBUTE))
            {
               String objectName = ((Element)filterChildNode).getAttribute(ENABLE_OBJECTNAME_ATTRIBUTE);
               // enable this objectName in the filter
               // may throw MalformedObjectNameException
               filter.enableObjectName(new ObjectName(objectName));
            }
            else
            {
               throw new Exception("'" + ENABLE_ELEMENT + "' element must have a '"
                     + ENABLE_TYPE_ATTRIBUTE + "' or a '" + ENABLE_OBJECTNAME_ATTRIBUTE + "' attribute");
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.