package org.opendaylight.controller.netconf.impl.osgi;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.ImmutableSet.Builder;
+import java.util.Set;
import org.opendaylight.controller.netconf.mapping.api.NetconfOperationService;
import org.opendaylight.controller.netconf.mapping.api.NetconfOperationServiceFactory;
import org.opendaylight.controller.netconf.mapping.api.NetconfOperationServiceSnapshot;
import org.opendaylight.controller.netconf.util.CloseableUtil;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
public class NetconfOperationServiceSnapshotImpl implements NetconfOperationServiceSnapshot {
private final Set<NetconfOperationService> services;
private final String netconfSessionIdForReporting;
- public NetconfOperationServiceSnapshotImpl(Set<NetconfOperationServiceFactory> factories, String sessionIdForReporting) {
- Set<NetconfOperationService> services = new HashSet<>();
+ public NetconfOperationServiceSnapshotImpl(final Set<NetconfOperationServiceFactory> factories, final String sessionIdForReporting) {
+ final Builder<NetconfOperationService> b = ImmutableSet.builder();
netconfSessionIdForReporting = sessionIdForReporting;
for (NetconfOperationServiceFactory factory : factories) {
- services.add(factory.createService(netconfSessionIdForReporting));
+ b.add(factory.createService(netconfSessionIdForReporting));
}
- this.services = Collections.unmodifiableSet(services);
+ this.services = b.build();
}
-
-
@Override
public String getNetconfSessionIdForReporting() {
return netconfSessionIdForReporting;