use of javax.management.MBeanRegistrationException in project aries by apache.
the class JMXAgentImpl method unregisterMBeans.
/**
* @see org.apache.aries.jmx.agent.JMXAgent#unregisterMBeans(javax.management.MBeanServer)
*/
public synchronized void unregisterMBeans(final MBeanServer server) {
for (MBeanHandler mBeanHandler : mbeansHandlers.keySet()) {
if (mbeansHandlers.get(mBeanHandler) == Boolean.TRUE) {
try {
String name = mBeanHandler.getName();
StandardMBean mbean = mBeanHandler.getMbean();
if (mbean != null) {
logger.log(LogService.LOG_INFO, "Unregistering " + mbean.getMBeanInterface().getName() + " to MBeanServer " + server + " with name " + name);
server.unregisterMBean(new ObjectName(name));
}
} catch (MBeanRegistrationException e) {
logger.log(LogService.LOG_ERROR, "Can't unregister MBean", e);
} catch (InstanceNotFoundException e) {
logger.log(LogService.LOG_ERROR, "MBean doesn't exist in the repository", e);
} catch (MalformedObjectNameException e) {
logger.log(LogService.LOG_ERROR, "Try to unregister with no valid objectname", e);
} catch (NullPointerException e) {
logger.log(LogService.LOG_ERROR, "Name of objectname can't be null ", e);
} catch (Exception e) {
logger.log(LogService.LOG_ERROR, "Cannot unregister MBean: " + mBeanHandler, e);
}
}
}
mbeanServers.remove(server);
}
use of javax.management.MBeanRegistrationException in project aries by apache.
the class JMXAgentImpl method unregisterMBean.
/**
* @see org.apache.aries.jmx.agent.JMXAgent#unregisterMBean(org.apache.aries.jmx.MBeanHandler)
*/
public synchronized void unregisterMBean(final MBeanHandler mBeanHandler) {
for (MBeanServer server : mbeanServers.keySet()) {
String name = mBeanHandler.getName();
try {
logger.log(LogService.LOG_INFO, "Unregistering mbean " + " to MBeanServer " + server + " with name " + name);
server.unregisterMBean(new ObjectName(name));
} catch (MBeanRegistrationException e) {
logger.log(LogService.LOG_ERROR, "Can't register MBean", e);
} catch (InstanceNotFoundException e) {
logger.log(LogService.LOG_ERROR, "MBean doesn't exist in the repository", e);
} catch (MalformedObjectNameException e) {
logger.log(LogService.LOG_ERROR, "Try to register with no valid objectname, Stopping registration", e);
return;
} catch (NullPointerException e) {
logger.log(LogService.LOG_ERROR, "Name of objectname can't be null, Stopping registration", e);
return;
}
}
mbeansHandlers.put(mBeanHandler, Boolean.FALSE);
}
use of javax.management.MBeanRegistrationException in project aries by apache.
the class Activator method registerMBeans.
protected void registerMBeans(MBeanServer mbeanServer) {
// register BlueprintStateMBean to MBean server
LOGGER.debug("Registering bundle state monitor with MBeanServer: {} with name: {}", mbeanServer, blueprintStateName);
try {
StandardMBean blueprintState = new RegistrableStandardEmitterMBean(new BlueprintState(bundleContext), BlueprintStateMBean.class);
mbeanServer.registerMBean(blueprintState, blueprintStateName);
} catch (InstanceAlreadyExistsException e) {
LOGGER.debug("Cannot register BlueprintStateMBean");
} catch (MBeanRegistrationException e) {
LOGGER.error("Cannot register BlueprintStateMBean", e);
} catch (NotCompliantMBeanException e) {
LOGGER.error("Cannot register BlueprintStateMBean", e);
}
// register BlueprintMetadataMBean to MBean server
LOGGER.debug("Registering bundle metadata monitor with MBeanServer: {} with name: {}", mbeanServer, blueprintMetadataName);
try {
StandardMBean blueprintMetadata = new StandardMBean(new BlueprintMetadata(bundleContext), BlueprintMetadataMBean.class);
mbeanServer.registerMBean(blueprintMetadata, blueprintMetadataName);
} catch (InstanceAlreadyExistsException e) {
LOGGER.debug("Cannot register BlueprintMetadataMBean");
} catch (MBeanRegistrationException e) {
LOGGER.error("Cannot register BlueprintMetadataMBean", e);
} catch (NotCompliantMBeanException e) {
LOGGER.error("Cannot register BlueprintMetadataMBean", e);
}
}
use of javax.management.MBeanRegistrationException in project aries by apache.
the class MBeanHolder method register.
void register(final MBeanServer server) {
ObjectInstance instance;
try {
instance = server.registerMBean(mbean, requestedObjectName);
registrations.put(server, instance.getObjectName());
} catch (InstanceAlreadyExistsException e) {
log.error("register: Failure registering MBean " + mbean, e);
} catch (MBeanRegistrationException e) {
log.error("register: Failure registering MBean " + mbean, e);
} catch (NotCompliantMBeanException e) {
log.error("register: Failure registering MBean " + mbean, e);
}
}
use of javax.management.MBeanRegistrationException in project geode by apache.
the class ConnectionNotificationFilterImpl method initializeHelperMbean.
private void initializeHelperMbean() {
try {
memberInfoWithStatsMBean = new MemberInfoWithStatsMBean(this);
MBeanServer mbs = getMBeanServer();
mbs.registerMBean(memberInfoWithStatsMBean, memberInfoWithStatsMBean.getObjectName());
/*
* We are not re-throwing these exceptions as failure create/register the GemFireTypesWrapper
* will not stop the Agent from working. But we are logging it as it could be an indication of
* some problem. Also not creating Localized String for the exception.
*/
} catch (OperationsException e) {
logger.info(LocalizedMessage.create(LocalizedStrings.AgentImpl_FAILED_TO_INITIALIZE_MEMBERINFOWITHSTATSMBEAN), e);
} catch (MBeanRegistrationException e) {
logger.info(LocalizedMessage.create(LocalizedStrings.AgentImpl_FAILED_TO_INITIALIZE_MEMBERINFOWITHSTATSMBEAN), e);
} catch (AdminException e) {
logger.info(LocalizedMessage.create(LocalizedStrings.AgentImpl_FAILED_TO_INITIALIZE_MEMBERINFOWITHSTATSMBEAN), e);
}
}
Aggregations