Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Fix Eclipse warnings in config-manager
[controller.git]
/
opendaylight
/
config
/
config-manager
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
config
/
manager
/
impl
/
osgi
/
BeanToOsgiServiceManager.java
diff --git
a/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/BeanToOsgiServiceManager.java
b/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/BeanToOsgiServiceManager.java
index 3d93a9df7dee72bb450af215bd7dea97f24199a5..51f99403148ba7b40301e52b63b391ae98c0134e 100644
(file)
--- a/
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/BeanToOsgiServiceManager.java
+++ b/
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/BeanToOsgiServiceManager.java
@@
-7,7
+7,7
@@
*/
package org.opendaylight.controller.config.manager.impl.osgi;
*/
package org.opendaylight.controller.config.manager.impl.osgi;
-import
static com.google.common.base.Preconditions.checkState
;
+import
com.google.common.base.Preconditions
;
import java.util.Dictionary;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Dictionary;
import java.util.HashSet;
import java.util.Hashtable;
@@
-40,13
+40,6
@@
public class BeanToOsgiServiceManager {
return new OsgiRegistration(instance, moduleIdentifier, bundleContext, serviceNamesToAnnotations);
}
return new OsgiRegistration(instance, moduleIdentifier, bundleContext, serviceNamesToAnnotations);
}
- private static Dictionary<String, String> createProps(String serviceName) {
- Hashtable<String, String> result = new Hashtable<>();
- result.put(SERVICE_NAME_OSGI_PROP, serviceName);
- return result;
- }
-
-
public static class OsgiRegistration implements AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(OsgiRegistration.class);
public static class OsgiRegistration implements AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(OsgiRegistration.class);
@@
-79,7
+72,7
@@
public class BeanToOsgiServiceManager {
continue;
}
continue;
}
- checkState(requiredInterface.isInstance(instance), instance.getClass().getName() +
+
Preconditions.
checkState(requiredInterface.isInstance(instance), instance.getClass().getName() +
" instance should implement " + requiredInterface.getName());
Dictionary<String, String> propertiesForOsgi = createProps(entry.getValue());
ServiceRegistration<?> serviceRegistration = bundleContext
" instance should implement " + requiredInterface.getName());
Dictionary<String, String> propertiesForOsgi = createProps(entry.getValue());
ServiceRegistration<?> serviceRegistration = bundleContext
@@
-103,8
+96,8
@@
public class BeanToOsgiServiceManager {
public synchronized void updateRegistrations(Map<ServiceInterfaceAnnotation, String /* service ref name */> newAnnotationMapping,
BundleContext bundleContext, AutoCloseable newInstance) {
public synchronized void updateRegistrations(Map<ServiceInterfaceAnnotation, String /* service ref name */> newAnnotationMapping,
BundleContext bundleContext, AutoCloseable newInstance) {
- boolean notEquals =
this.instance != newInstance
;
- notEquals |=
newAnnotationMapping.equals(serviceNamesToAnnotations) == false
;
+ boolean notEquals =
!this.instance.equals(newInstance)
;
+ notEquals |=
!newAnnotationMapping.equals(serviceNamesToAnnotations)
;
if (notEquals) {
// FIXME: changing from old state to new state can be improved by computing the diff
LOG.debug("Detected change in service registrations for {}: old: {}, new: {}", moduleIdentifier,
if (notEquals) {
// FIXME: changing from old state to new state can be improved by computing the diff
LOG.debug("Detected change in service registrations for {}: old: {}, new: {}", moduleIdentifier,
@@
-116,5
+109,11
@@
public class BeanToOsgiServiceManager {
serviceRegistrations.addAll(newRegs);
}
}
serviceRegistrations.addAll(newRegs);
}
}
+
+ private static Dictionary<String, String> createProps(String serviceName) {
+ Hashtable<String, String> result = new Hashtable<>();
+ result.put(SERVICE_NAME_OSGI_PROP, serviceName);
+ return result;
+ }
}
}
}
}