Instead of brewing our own class, reuse an Entry implementation from
JRE.
Change-Id: I94972985050921838f0b217a0957a413d7971427
Signed-off-by: Robert Varga <rovarga@cisco.com>
package org.opendaylight.controller.config.manager.impl;
import static com.google.common.base.Preconditions.checkNotNull;
package org.opendaylight.controller.config.manager.impl;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
+import java.util.AbstractMap.SimpleImmutableEntry;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
} catch (InstanceAlreadyExistsException e) {
throw new IllegalStateException("Possible error in code. Cannot register " + result, e);
}
} catch (InstanceAlreadyExistsException e) {
throw new IllegalStateException("Possible error in code. Cannot register " + result, e);
}
- mBeans.put(serviceReference, createMXBeanEntry(dummyMXBean, dummyMXBeanRegistration));
+ mBeans.put(serviceReference, new SimpleImmutableEntry<>(dummyMXBean, dummyMXBeanRegistration));
} else {
// update
mxBeanEntry.getKey().setCurrentImplementation(moduleON);
} else {
// update
mxBeanEntry.getKey().setCurrentImplementation(moduleON);
- private Entry<ServiceReferenceMXBeanImpl, ServiceReferenceJMXRegistration> createMXBeanEntry(
- final ServiceReferenceMXBeanImpl mxBean, final ServiceReferenceJMXRegistration registration) {
- return new Entry<ServiceReferenceMXBeanImpl, ServiceReferenceJMXRegistration>() {
- @Override
- public ServiceReferenceMXBeanImpl getKey() {
- return mxBean;
- }
-
- @Override
- public ServiceReferenceJMXRegistration getValue() {
- return registration;
- }
-
- @Override
- public ServiceReferenceJMXRegistration setValue(final ServiceReferenceJMXRegistration value) {
- throw new UnsupportedOperationException();
- }
- };
- }
-
private ObjectName getServiceON(final ServiceReference serviceReference) {
if (writable) {
return ObjectNameUtil.createTransactionServiceON(serviceReferenceRegistrator.getNullableTransactionName(),
private ObjectName getServiceON(final ServiceReference serviceReference) {
if (writable) {
return ObjectNameUtil.createTransactionServiceON(serviceReferenceRegistrator.getNullableTransactionName(),