类javax.management.AttributeChangeNotificationFilter源码实例Demo

下面列出了怎么用javax.management.AttributeChangeNotificationFilter的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: gemfirexd-oss   文件: MX4JModelMBean.java
public void addAttributeChangeNotificationListener(NotificationListener listener, String attributeName, Object handback) throws MBeanException, RuntimeOperationsException, IllegalArgumentException
{
   if (listener == null) throw new RuntimeOperationsException(new IllegalArgumentException(LocalizedStrings.MX4JModelMBean_LISTENER_CANNOT_BE_NULL.toLocalizedString()));
   AttributeChangeNotificationFilter filter = new AttributeChangeNotificationFilter();
   if (attributeName != null)
   {
      filter.enableAttribute(attributeName);
   }
   else
   {
      MBeanAttributeInfo[] ai = m_modelMBeanInfo.getAttributes();
      for (int i = 0; i < ai.length; i++)
      {
         Descriptor d = ((ModelMBeanAttributeInfo)ai[i]).getDescriptor();
         filter.enableAttribute((String)d.getFieldValue("name"));
      }
   }

   getAttributeChangeBroadcaster().addNotificationListener(listener, filter, handback);

   Logger logger = getLogger();
   if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Listener " + listener + " for attribute " + attributeName + " added successfully, handback is " + handback);
}
 
源代码2 项目: gemfirexd-oss   文件: MX4JModelMBean.java
private void removeAttributeChangeNotificationListener(NotificationListener listener, String attributeName, Object handback) throws MBeanException, RuntimeOperationsException, ListenerNotFoundException
{
   if (listener == null) throw new RuntimeOperationsException(new IllegalArgumentException(LocalizedStrings.MX4JModelMBean_LISTENER_CANNOT_BE_NULL.toLocalizedString()));
   AttributeChangeNotificationFilter filter = new AttributeChangeNotificationFilter();
   if (attributeName != null)
   {
      filter.enableAttribute(attributeName);
   }
   else
   {
      MBeanAttributeInfo[] ai = m_modelMBeanInfo.getAttributes();
      for (int i = 0; i < ai.length; i++)
      {
         Descriptor d = ((ModelMBeanAttributeInfo)ai[i]).getDescriptor();
         filter.enableAttribute((String)d.getFieldValue("name"));
      }
   }

   getAttributeChangeBroadcaster().removeNotificationListener(listener, filter, handback);

   Logger logger = getLogger();
   if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Listener " + listener + " for attribute " + attributeName + " removed successfully, handback is " + handback);
}
 
源代码3 项目: gemfirexd-oss   文件: MX4JModelMBean.java
public void addAttributeChangeNotificationListener(NotificationListener listener, String attributeName, Object handback) throws MBeanException, RuntimeOperationsException, IllegalArgumentException
{
   if (listener == null) throw new RuntimeOperationsException(new IllegalArgumentException(LocalizedStrings.MX4JModelMBean_LISTENER_CANNOT_BE_NULL.toLocalizedString()));
   AttributeChangeNotificationFilter filter = new AttributeChangeNotificationFilter();
   if (attributeName != null)
   {
      filter.enableAttribute(attributeName);
   }
   else
   {
      MBeanAttributeInfo[] ai = m_modelMBeanInfo.getAttributes();
      for (int i = 0; i < ai.length; i++)
      {
         Descriptor d = ((ModelMBeanAttributeInfo)ai[i]).getDescriptor();
         filter.enableAttribute((String)d.getFieldValue("name"));
      }
   }

   getAttributeChangeBroadcaster().addNotificationListener(listener, filter, handback);

   Logger logger = getLogger();
   if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Listener " + listener + " for attribute " + attributeName + " added successfully, handback is " + handback);
}
 
源代码4 项目: gemfirexd-oss   文件: MX4JModelMBean.java
private void removeAttributeChangeNotificationListener(NotificationListener listener, String attributeName, Object handback) throws MBeanException, RuntimeOperationsException, ListenerNotFoundException
{
   if (listener == null) throw new RuntimeOperationsException(new IllegalArgumentException(LocalizedStrings.MX4JModelMBean_LISTENER_CANNOT_BE_NULL.toLocalizedString()));
   AttributeChangeNotificationFilter filter = new AttributeChangeNotificationFilter();
   if (attributeName != null)
   {
      filter.enableAttribute(attributeName);
   }
   else
   {
      MBeanAttributeInfo[] ai = m_modelMBeanInfo.getAttributes();
      for (int i = 0; i < ai.length; i++)
      {
         Descriptor d = ((ModelMBeanAttributeInfo)ai[i]).getDescriptor();
         filter.enableAttribute((String)d.getFieldValue("name"));
      }
   }

   getAttributeChangeBroadcaster().removeNotificationListener(listener, filter, handback);

   Logger logger = getLogger();
   if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Listener " + listener + " for attribute " + attributeName + " removed successfully, handback is " + handback);
}
 
 类所在包
 同包方法