@Test public void closeServiceInstance() throws Exception { controllerInstance.instantiateServiceInstance(); controllerInstance.closeServiceInstance(); verify(listenerRegistration, atLeastOnce()).close(); verify(node, atLeastOnce()).close(); verify(sxpRpcServiceRegistration).close(); verify(sxpConfigRpcServiceRegistration).close(); }
@Override public synchronized ListenableFuture<Void> closeServiceInstance() { LOG.warn("Clustering provider closed service for {}", this.getClass().getSimpleName()); closeRpcServices(); dataChangeListenerRegistrations.forEach(ListenerRegistration::close); dataChangeListenerRegistrations.clear(); NodesRegister.getNodes().forEach(node -> { if (node instanceof SxpDatastoreNode) { ((SxpDatastoreNode) node).close(); } else { node.shutdown(); } NodesRegister.unRegister(node.getNodeId().getValue()); }); datastoreAccess.close(); return Futures.immediateFuture(null); }
SxpControllerInstance implements ClusterSingletonService, AutoCloseable { @Override public synchronized ListenableFuture<Void> closeServiceInstance() { LOG.warn("Clustering provider closed service for {}", this.getClass().getSimpleName()); closeRpcServices(); dataChangeListenerRegistrations.forEach(ListenerRegistration::close); dataChangeListenerRegistrations.clear(); NodesRegister.getNodes().forEach(node -> { if (node instanceof SxpDatastoreNode) { ((SxpDatastoreNode) node).close(); } else { node.shutdown(); } NodesRegister.unRegister(node.getNodeId().getValue()); }); datastoreAccess.close(); return Futures.immediateFuture(null); } }
SxpControllerInstance implements ClusterSingletonService, AutoCloseable { @Override public synchronized ListenableFuture<Void> closeServiceInstance() { LOG.warn("Clustering provider closed service for {}", this.getClass().getSimpleName()); closeRpcServices(); dataChangeListenerRegistrations.forEach(ListenerRegistration::close); dataChangeListenerRegistrations.clear(); NodesRegister.getNodes().forEach(node -> { if (node instanceof SxpDatastoreNode) { ((SxpDatastoreNode) node).close(); } else { node.shutdown(); } NodesRegister.unRegister(node.getNodeId().getValue()); }); datastoreAccess.close(); return Futures.immediateFuture(null); }  }
SxpControllerInstance implements ClusterSingletonService, AutoCloseable { @Override public synchronized ListenableFuture<Void> closeServiceInstance() { LOG.warn("Clustering provider closed service for {}", this.getClass().getSimpleName()); closeRpcServices(); dataChangeListenerRegistrations.forEach(ListenerRegistration::close); dataChangeListenerRegistrations.clear(); NodesRegister.getNodes().forEach(node -> { if (node instanceof SxpDatastoreNode) { ((SxpDatastoreNode) node).close(); } else { node.shutdown(); } NodesRegister.unRegister(node.getNodeId().getValue()); }); datastoreAccess.close(); return Futures.immediateFuture(null); }  void init(); @Override synchronized void instantiateServiceInstance(); @Override synchronized ListenableFuture<Void> closeServiceInstance(); @Override ServiceGroupIdentifier getIdentifier(); @Override synchronized void close(); void setDataBroker(DataBroker dataBroker); void setClusteringServiceProvider(ClusterSingletonServiceProvider clusteringServiceProvider); void setRpcProviderService(RpcProviderService rpcProviderService); }
SxpControllerInstance implements ClusterSingletonService, AutoCloseable { @Override public synchronized ListenableFuture<Void> closeServiceInstance() { LOG.warn("Clustering provider closed service for {}", this.getClass().getSimpleName()); closeRpcServices(); dataChangeListenerRegistrations.forEach(ListenerRegistration::close); dataChangeListenerRegistrations.clear(); NodesRegister.getNodes().forEach(node -> { if (node instanceof SxpDatastoreNode) { ((SxpDatastoreNode) node).close(); } else { node.shutdown(); } NodesRegister.unRegister(node.getNodeId().getValue()); }); datastoreAccess.close(); return Futures.immediateFuture(null); }  void init(); @Override synchronized void instantiateServiceInstance(); @Override synchronized ListenableFuture<Void> closeServiceInstance(); @Override ServiceGroupIdentifier getIdentifier(); @Override synchronized void close(); void setDataBroker(DataBroker dataBroker); void setClusteringServiceProvider(ClusterSingletonServiceProvider clusteringServiceProvider); void setRpcProviderService(RpcProviderService rpcProviderService); static final ServiceGroupIdentifier IDENTIFIER; }