use of javax.management.RuntimeOperationsException in project geode by apache.
the class MX4JModelMBean method setModelMBeanInfo.
public void setModelMBeanInfo(ModelMBeanInfo modelMBeanInfo) throws MBeanException, RuntimeOperationsException {
if (modelMBeanInfo == null)
throw new RuntimeOperationsException(new IllegalArgumentException(LocalizedStrings.MX4JModelMBean_MODELMBEANINFO_CANNOT_BE_NULL.toLocalizedString()));
if (!isModelMBeanInfoValid(modelMBeanInfo))
throw new RuntimeOperationsException(new IllegalArgumentException(LocalizedStrings.MX4JModelMBean_MODELMBEANINFO_IS_INVALID.toLocalizedString()));
m_modelMBeanInfo = (ModelMBeanInfo) modelMBeanInfo.clone();
Logger logger = getLogger();
if (logger.isEnabledFor(Logger.DEBUG))
logger.debug("ModelMBeanInfo successfully set to: " + m_modelMBeanInfo);
// Only now the MBean can be registered in the MBeanServer
m_canBeRegistered = true;
}
use of javax.management.RuntimeOperationsException in project geode by apache.
the class MX4JModelMBean method addAttributeChangeNotificationListener.
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);
}
Aggregations