X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-dom-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fdom%2Fbroker%2Fosgi%2FAbstractBrokerServiceProxy.java;h=8d33ff7997dab4b2a09d813c9200e8b95f7dc762;hp=7e3d9be59c6d751fea65047d0e16fc560dea4531;hb=05861a85bc830af3fce638c301949da23c803ee4;hpb=a1b55fb491e235c028e1d451aff4b1d261d5a86c diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/AbstractBrokerServiceProxy.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/AbstractBrokerServiceProxy.java index 7e3d9be59c..8d33ff7997 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/AbstractBrokerServiceProxy.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/AbstractBrokerServiceProxy.java @@ -1,22 +1,33 @@ +/* + * Copyright (c) 2014 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, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.dom.broker.osgi; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Preconditions.checkState; + import java.util.Collections; import java.util.HashSet; import java.util.Set; +import javax.annotation.Nullable; + import org.opendaylight.controller.sal.core.api.BrokerService; import org.opendaylight.yangtools.concepts.Registration; import org.osgi.framework.ServiceReference; -import static com.google.common.base.Preconditions.*; public abstract class AbstractBrokerServiceProxy implements AutoCloseable, BrokerService { private T delegate; private final ServiceReference reference; - public AbstractBrokerServiceProxy(ServiceReference ref, T delegate) { + public AbstractBrokerServiceProxy(final @Nullable ServiceReference ref, final T delegate) { this.delegate = checkNotNull(delegate, "Delegate should not be null."); - this.reference = checkNotNull(ref, "Reference should not be null."); + this.reference = ref; } protected final T getDelegate() { @@ -28,9 +39,9 @@ public abstract class AbstractBrokerServiceProxy implem return reference; } - private Set> registrations = Collections.synchronizedSet(new HashSet>()); + private final Set> registrations = Collections.synchronizedSet(new HashSet>()); - protected > R addRegistration(R registration) { + protected > R addRegistration(final R registration) { if (registration != null) { registrations.add(registration); }