X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=netconf%2Fmdsal-netconf-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fmdsal%2Fconnector%2FCurrentSchemaContext.java;h=fa7f273465b24a665815026412a8e13f3a2afd57;hb=2863144fca46ac7336cc7b7a6ff124799eb87428;hp=a45d5a63775787bbf1956c9f63ef013c723606ef;hpb=8ada0df32ab6511ab58e0576611cf74e41d1a763;p=netconf.git diff --git a/netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/CurrentSchemaContext.java b/netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/CurrentSchemaContext.java index a45d5a6377..fa7f273465 100644 --- a/netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/CurrentSchemaContext.java +++ b/netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/CurrentSchemaContext.java @@ -23,10 +23,10 @@ import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource; import org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceProvider; public class CurrentSchemaContext implements SchemaContextListener, AutoCloseable { - final AtomicReference currentContext = new AtomicReference(); + private final AtomicReference currentContext = new AtomicReference(); private final ListenerRegistration schemaContextListenerListenerRegistration; - private final Set listeners1 = Collections.synchronizedSet(Sets.newHashSet()); - private SchemaSourceProvider rootSchemaSourceProvider; + private final Set listeners1 = Collections.synchronizedSet(Sets.newHashSet()); + private final SchemaSourceProvider rootSchemaSourceProvider; public SchemaContext getCurrentContext() { Preconditions.checkState(currentContext.get() != null, "Current context not received"); @@ -44,7 +44,7 @@ public class CurrentSchemaContext implements SchemaContextListener, AutoCloseabl // FIXME is notifying all the listeners from this callback wise ? final Set addedCaps = MdsalNetconfOperationServiceFactory.transformCapabilities(currentContext.get(), rootSchemaSourceProvider); for (final CapabilityListener listener : listeners1) { - listener.onCapabilitiesChanged(addedCaps, Collections.emptySet()); + listener.onCapabilitiesChanged(addedCaps, Collections.emptySet()); } } @@ -58,11 +58,6 @@ public class CurrentSchemaContext implements SchemaContextListener, AutoCloseabl public AutoCloseable registerCapabilityListener(final CapabilityListener listener) { listener.onCapabilitiesChanged(MdsalNetconfOperationServiceFactory.transformCapabilities(currentContext.get(), rootSchemaSourceProvider), Collections.emptySet()); listeners1.add(listener); - return new AutoCloseable() { - @Override - public void close() throws Exception { - listeners1.remove(listener); - } - }; + return () -> listeners1.remove(listener); } } \ No newline at end of file