/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
final synchronized void unregisterMBean(final ObjectName on) {
// first check that on was registered using this instance
boolean removed = registeredObjectNames.remove(on);
- Preconditions.checkState(removed, "Cannot unregister - ObjectName not found in 'registeredObjectNames': %s", on);
+ Preconditions.checkState(removed, "Cannot unregister - ObjectName not found in 'registeredObjectNames': %s",
+ on);
try {
getMBeanServer().unregisterMBean(on);
for (ObjectName on : registeredObjectNames) {
try {
getMBeanServer().unregisterMBean(on);
- } catch (final Exception e) {
+ } catch (final InstanceNotFoundException | MBeanRegistrationException e) {
LOG.warn("Ignoring error while unregistering {}", on, e);
}
}