本文整理了Java中javax.management.AttributeChangeNotificationFilter
类的一些代码示例,展示了AttributeChangeNotificationFilter
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AttributeChangeNotificationFilter
类的具体详情如下:
包路径:javax.management.AttributeChangeNotificationFilter
类名称:AttributeChangeNotificationFilter
暂无
代码示例来源:origin: apache/geode
@Override
public void addAttributeChangeNotificationListener(NotificationListener listener,
String attributeName, Object handback)
throws MBeanException, RuntimeOperationsException, IllegalArgumentException {
if (listener == null)
throw new RuntimeOperationsException(new IllegalArgumentException(
"Listener cannot be null."));
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);
}
代码示例来源:origin: net.open-esb.core/nmr
/**
* Register as a listener for attribute change events
*/
private void startListeningToConfigurationMBean()
{
javax.management.MBeanServer mbeanServer =
mEnvironmentContext.getMBeanServer();
/**
* Create a AttributeChangeNotificationFilter
*/
javax.management.AttributeChangeNotificationFilter filter =
new javax.management.AttributeChangeNotificationFilter();
filter.disableAllAttributes();
filter.enableAttribute(com.sun.jbi.management.config.
SystemConfigurationFactory.MSG_SVC_STATS_ENABLED);
try
{
mbeanServer.addNotificationListener(
MBeanHelper.getSystemConfigMBeanName(),
mStatistics, filter, null);
}
catch( Exception ex )
{
mLog.log(Level.FINE, "Exception occured in startListeningToConfigurationMBean: {0}", ex);
}
}
代码示例来源:origin: org.apache.camel/camel-jmx
@Override
public boolean isNotificationEnabled(Notification notification) {
boolean enabled = super.isNotificationEnabled(notification);
if (!enabled) {
return false;
}
boolean match = false;
if (stringToCompare != null) {
AttributeChangeNotification acn = (AttributeChangeNotification) notification;
Object newValue = acn.getNewValue();
// special for null
if ("null".equals(stringToCompare) && newValue == null) {
match = true;
} else if (newValue != null) {
match = stringToCompare.equals(newValue.toString());
}
return notifyMatch == match;
} else {
return true;
}
}
代码示例来源:origin: net.open-esb.core/manage
new javax.management.AttributeChangeNotificationFilter();
filter.disableAllAttributes();
filter.enableAttribute(mLogger.getName());
代码示例来源:origin: apache/geode
private void removeAttributeChangeNotificationListener(NotificationListener listener,
String attributeName, Object handback)
throws MBeanException, RuntimeOperationsException, ListenerNotFoundException {
if (listener == null)
throw new RuntimeOperationsException(new IllegalArgumentException(
"Listener cannot be null."));
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);
}
代码示例来源:origin: mx4j/mx4j-tools
protected void startObserving() throws Exception
{
AttributeChangeNotificationFilter filter = new AttributeChangeNotificationFilter();
filter.enableAttribute(observedAttribute);
server.addNotificationListener(observedName, this, filter, null);
registered = true;
}
代码示例来源:origin: org.apache.servicemix/servicemix-core
/**
* @param l
* @param attrName
* @param handback
* @throws MBeanException
* @throws RuntimeOperationsException
* @throws IllegalArgumentException
*/
public void addAttributeChangeNotificationListener(NotificationListener l, String attrName, Object handback) throws MBeanException,
RuntimeOperationsException, IllegalArgumentException {
AttributeChangeNotificationFilter currFilter = new AttributeChangeNotificationFilter();
currFilter.enableAttribute(attrName);
broadcasterSupport.addNotificationListener(l, currFilter, handback);
}
代码示例来源:origin: org.jboss.microcontainer/jboss-jmx-mc-int
AttributeChangeNotificationFilter filter = new AttributeChangeNotificationFilter();
filter.enableAttribute(attributeName);
代码示例来源:origin: org.jboss.kernel/jboss-jmx-mc-int
AttributeChangeNotificationFilter filter = new AttributeChangeNotificationFilter();
filter.enableAttribute(attributeName);
代码示例来源:origin: org.jboss.jbossas/jboss-as-mbeans
/**
*/
public void addAttributeChangeNotificationListener(
NotificationListener listener,
String attributeName,
Object handback) throws MBeanException
{
// Check the attribute info
ModelMBeanInfo minfo = (ModelMBeanInfo) info;
AttributeChangeNotificationFilter filter = null;
if (attributeName != null)
{
ModelMBeanAttributeInfo ainfo = minfo.getAttribute(attributeName);
if( ainfo == null )
{
throw new RuntimeOperationsException(
new IllegalArgumentException("Attribute does not exist: "+attributeName));
}
filter = new AttributeChangeNotificationFilter();
filter.enableAttribute(attributeName);
}
else
{
filter = new AttributeChangeNotificationFilter();
MBeanAttributeInfo[] allAttributes = minfo.getAttributes();
for (int i = 0; i < allAttributes.length; ++i)
filter.enableAttribute(allAttributes[i].getName());
}
notifier.addNotificationListener(listener, filter, handback);
}
代码示例来源:origin: org.jboss.mx/jboss-mbeans
/**
*/
public void addAttributeChangeNotificationListener(
NotificationListener listener,
String attributeName,
Object handback) throws MBeanException
{
// Check the attribute info
ModelMBeanInfo minfo = (ModelMBeanInfo) info;
AttributeChangeNotificationFilter filter = null;
if (attributeName != null)
{
ModelMBeanAttributeInfo ainfo = minfo.getAttribute(attributeName);
if( ainfo == null )
{
throw new RuntimeOperationsException(
new IllegalArgumentException("Attribute does not exist: "+attributeName));
}
filter = new AttributeChangeNotificationFilter();
filter.enableAttribute(attributeName);
}
else
{
filter = new AttributeChangeNotificationFilter();
MBeanAttributeInfo[] allAttributes = minfo.getAttributes();
for (int i = 0; i < allAttributes.length; ++i)
filter.enableAttribute(allAttributes[i].getName());
}
notifier.addNotificationListener(listener, filter, handback);
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-cluster
public void createService() throws Exception
{
super.createService();
// we register our inner-class to retrieve STATE notifications from our container
AttributeChangeNotificationFilter filter = new AttributeChangeNotificationFilter();
filter.enableAttribute("State");
listener = new StateChangeListener();
getServer().addNotificationListener(getTargetName(), listener, filter, null);
}
代码示例来源:origin: io.snappydata/gemfire-core
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);
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-cluster
public void create () throws Exception
{
super.create ();
// we register our inner-class to retrieve STATE notifications from our container
//
AttributeChangeNotificationFilter filter = new AttributeChangeNotificationFilter ();
filter.enableAttribute ("State");
// ************************************************************************
// NOTE: We could also subscribe for the container service events instead of the
// ejbModule service events. This problem comes from beans using other beans
// in the same ejbModule: we may receive an IllegalStateException thrown
// by the Container implementation. Using ejbModule events solve this
// problem.
// ************************************************************************
this.container.getServer ().
addNotificationListener (this.container.getEjbModule ().getServiceName (),
new ProxyFactoryHA.StateChangeListener (),
filter,
null);
}
代码示例来源:origin: io.snappydata/gemfire-core
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);
}
代码示例来源:origin: org.apache.geode/gemfire-core
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);
}
代码示例来源:origin: org.apache.geode/gemfire-core
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);
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-cluster
public void create() throws Exception {
super.create ();
this.allowInvocations = false;
this.allowRemoteInvocations = false;
this.isDebugEnabled = log.isDebugEnabled ();
ejbModuleName = ejbModule.getServiceName().toString();
// we register our inner-class to retrieve STATE notifications from our container
//
AttributeChangeNotificationFilter filter = new AttributeChangeNotificationFilter ();
filter.enableAttribute ("State");
this.container.getServer ().
addNotificationListener (this.container.getEjbModule ().getServiceName (),
new CleanShutdownInterceptor.StateChangeListener (),
filter,
null);
// we need a way to find all CleanShutDownInterceptor of an EjbModule
//
ejbModule.putModuleData ("CleanShutDownInterceptor-" + this.container.getServiceName ().toString (), this);
}
内容来源于网络,如有侵权,请联系作者删除!