BwFetchingService implements DataTreeChangeListener<NodeConnector> { public void close() { if (portListner != null) { LOG.info("Closing portListener..."); portListner.close(); } if (!exec.isShutdown()) { LOG.info("Stopping executor service..."); exec.shutdownNow(); } LOG.info("BwFetchingService closed"); } BwFetchingService(DataBroker dataBroker); @Override void onDataTreeChanged(@Nonnull Collection<DataTreeModification<NodeConnector>> changes); void addListeningPort(String portId); void removeListeningPort(String portId); void close();  }
@Test public void testClose() throws Exception { service.close(); }