@Test public void close() throws Exception { Mockito.when(dataBroker.registerDataTreeChangeListener(SxpClusterRouteManager.ROUTING_DEFINITION_DT_IDENTIFIER, manager)).thenReturn(listenerRegistration); manager.init(); manager.instantiateServiceInstance(); Assert.assertEquals(RouteListenerState.BEFORE_FIRST, manager.getState()); manager.close(); Mockito.verify(cssProvider).registerClusterSingletonService(manager); Mockito.verify(cssRegistration).close(); Mockito.verify(dataBroker) .registerDataTreeChangeListener(SxpClusterRouteManager.ROUTING_DEFINITION_DT_IDENTIFIER, manager); Mockito.verify(listenerRegistration).close(); Mockito.verify(routeReactor).wipeRouting(); Assert.assertEquals(RouteListenerState.STOPPED, manager.getState()); }
@Override public void close() throws Exception { cssRegistration.close(); LOG.info("definitely closing instance and scheduling wipe-route task"); synchronized (stateLock) { state = RouteListenerState.STOPPED; routingDefinitionListenerRegistration.close(); final FluentFuture<? extends CommitInfo> routingOutcome = routeReactor.wipeRouting(); Futures.addCallback(routingOutcome, LOGGING_CALLBACK_CLOSE); } }
SxpClusterRouteManager implements ClusteredDataTreeChangeListener<SxpClusterRoute>, ClusterSingletonService, AutoCloseable { @Override public void close() throws Exception { cssRegistration.close(); LOG.info("definitely closing instance and scheduling wipe-route task"); synchronized (stateLock) { state = RouteListenerState.STOPPED; routingDefinitionListenerRegistration.close(); final FluentFuture<? extends CommitInfo> routingOutcome = routeReactor.wipeRouting(); Futures.addCallback(routingOutcome, LOGGING_CALLBACK_CLOSE); } } }
SxpClusterRouteManager implements ClusteredDataTreeChangeListener<SxpClusterRoute>, ClusterSingletonService, AutoCloseable { @Override public void close() throws Exception { cssRegistration.close(); LOG.info("definitely closing instance and scheduling wipe-route task"); synchronized (stateLock) { state = RouteListenerState.STOPPED; routingDefinitionListenerRegistration.close(); final FluentFuture<? extends CommitInfo> routingOutcome = routeReactor.wipeRouting(); Futures.addCallback(routingOutcome, LOGGING_CALLBACK_CLOSE); } } SxpClusterRouteManager(final DataBroker dataBroker, final ClusterSingletonServiceProvider cssProvider,
            final RouteReactor routeReactor); }
SxpClusterRouteManager implements ClusteredDataTreeChangeListener<SxpClusterRoute>, ClusterSingletonService, AutoCloseable { @Override public void close() throws Exception { cssRegistration.close(); LOG.info("definitely closing instance and scheduling wipe-route task"); synchronized (stateLock) { state = RouteListenerState.STOPPED; routingDefinitionListenerRegistration.close(); final FluentFuture<? extends CommitInfo> routingOutcome = routeReactor.wipeRouting(); Futures.addCallback(routingOutcome, LOGGING_CALLBACK_CLOSE); } } SxpClusterRouteManager(final DataBroker dataBroker, final ClusterSingletonServiceProvider cssProvider,
            final RouteReactor routeReactor); void init(); @Override void onDataTreeChanged(@Nonnull Collection<DataTreeModification<SxpClusterRoute>> changes); @Override ServiceGroupIdentifier getIdentifier(); @Override void instantiateServiceInstance(); @Override ListenableFuture<Void> closeServiceInstance(); @Override void close(); }
SxpClusterRouteManager implements ClusteredDataTreeChangeListener<SxpClusterRoute>, ClusterSingletonService, AutoCloseable { @Override public void close() throws Exception { cssRegistration.close(); LOG.info("definitely closing instance and scheduling wipe-route task"); synchronized (stateLock) { state = RouteListenerState.STOPPED; routingDefinitionListenerRegistration.close(); final FluentFuture<? extends CommitInfo> routingOutcome = routeReactor.wipeRouting(); Futures.addCallback(routingOutcome, LOGGING_CALLBACK_CLOSE); } } SxpClusterRouteManager(final DataBroker dataBroker, final ClusterSingletonServiceProvider cssProvider,
            final RouteReactor routeReactor); void init(); @Override void onDataTreeChanged(@Nonnull Collection<DataTreeModification<SxpClusterRoute>> changes); @Override ServiceGroupIdentifier getIdentifier(); @Override void instantiateServiceInstance(); @Override ListenableFuture<Void> closeServiceInstance(); @Override void close();  }