@Test public void testClose() throws Exception { when(sxpNode.getDomains()).thenReturn(domains); domain.putConnection(getSxpConnection("127.0.0.1")); domain.putConnection(getSxpConnection("127.0.0.2")); domain.putConnection(getSxpConnection("127.0.0.3")); domain.close(); connections.forEach(c -> verify(c).shutdown()); }
@Override public void close() { LOG.info("Closig SXP domain and its connections: {}", this); getConnections().forEach(SxpConnection::shutdown); try { sxpDatabase.close(); } catch (Exception e) { LOG.error("{} Failed to properly close the SXP DB", this); } try { masterDatabase.close(); } catch (Exception e) { LOG.error("{} Failed to properly close the Master DB", this); } }
SxpDomain implements AutoCloseable { @Override public void close() { LOG.info("Closig SXP domain and its connections: {}", this); getConnections().forEach(SxpConnection::shutdown); try { sxpDatabase.close(); } catch (Exception e) { LOG.error("{} Failed to properly close the SXP DB", this); } try { masterDatabase.close(); } catch (Exception e) { LOG.error("{} Failed to properly close the Master DB", this); } } }
SxpDomain implements AutoCloseable { @Override public void close() { LOG.info("Closig SXP domain and its connections: {}", this); getConnections().forEach(SxpConnection::shutdown); try { sxpDatabase.close(); } catch (Exception e) { LOG.error("{} Failed to properly close the SXP DB", this); } try { masterDatabase.close(); } catch (Exception e) { LOG.error("{} Failed to properly close the Master DB", this); } } private  SxpDomain(SxpNode owner, String name, SxpDatabaseInf sxpDatabase, MasterDatabaseInf masterDatabase); }
SxpDomain implements AutoCloseable { @Override public void close() { LOG.info("Closig SXP domain and its connections: {}", this); getConnections().forEach(SxpConnection::shutdown); try { sxpDatabase.close(); } catch (Exception e) { LOG.error("{} Failed to properly close the SXP DB", this); } try { masterDatabase.close(); } catch (Exception e) { LOG.error("{} Failed to properly close the Master DB", this); } } private  SxpDomain(SxpNode owner, String name, SxpDatabaseInf sxpDatabase, MasterDatabaseInf masterDatabase); static SxpDomain createInstance(SxpNode owner, String name, SxpDatabaseInf sxpDatabase,
            MasterDatabaseInf masterDatabase); static SxpDomain createInstance(SxpNode owner,
                                           org.opendaylight.yang.gen.v1.urn.opendaylight.sxp.node.rev160308.network.topology.topology.node.sxp.domains.SxpDomain domain,
                                           MasterDatabaseInf masterDB,
                                           SxpDatabaseInf sxpDB); static SxpDomain createInstance(SxpNode owner,
            org.opendaylight.yang.gen.v1.urn.opendaylight.sxp.node.rev160308.network.topology.topology.node.sxp.domains.SxpDomain domain); Map<String, SxpBindingFilter<?, ? extends SxpDomainFilterFields>> getFilters(); boolean addFilter(SxpBindingFilter<?, ? extends SxpDomainFilterFields> filter); SxpBindingFilter<?, ? extends SxpDomainFilterFields> removeFilter(FilterSpecific specific, String name); boolean updateFilter(SxpBindingFilter<?, ? extends SxpDomainFilterFields> newFilter); void pushToSharedMasterDatabases(final List<T> removed, final List<T> added); void pushToSharedSxpDatabases(NodeId nodeIdRemote, SxpBindingFilter<?, ? extends SxpFilterFields> sxpFilter,
            List<SxpDatabaseBinding> removed, List<SxpDatabaseBinding> added); MasterDatabaseInf getMasterDatabase(); SxpDatabaseInf getSxpDatabase(); String getName(); List<SxpConnection> getConnections(); SxpConnection getConnection(InetSocketAddress address); boolean addConnectionTemplate(T template); SxpConnectionTemplateFields removeConnectionTemplate(IpPrefix templatePrefix); SxpConnectionTemplateFields getTemplate(InetSocketAddress address); Collection<SxpConnectionTemplateFields> getConnectionTemplates(); boolean hasConnection(InetSocketAddress address); SxpConnection putConnection(SxpConnection connection); SxpConnection removeConnection(InetSocketAddress address); @Override void close(); }
SxpDomain implements AutoCloseable { @Override public void close() { LOG.info("Closig SXP domain and its connections: {}", this); getConnections().forEach(SxpConnection::shutdown); try { sxpDatabase.close(); } catch (Exception e) { LOG.error("{} Failed to properly close the SXP DB", this); } try { masterDatabase.close(); } catch (Exception e) { LOG.error("{} Failed to properly close the Master DB", this); } } private  SxpDomain(SxpNode owner, String name, SxpDatabaseInf sxpDatabase, MasterDatabaseInf masterDatabase); static SxpDomain createInstance(SxpNode owner, String name, SxpDatabaseInf sxpDatabase,
            MasterDatabaseInf masterDatabase); static SxpDomain createInstance(SxpNode owner,
                                           org.opendaylight.yang.gen.v1.urn.opendaylight.sxp.node.rev160308.network.topology.topology.node.sxp.domains.SxpDomain domain,
                                           MasterDatabaseInf masterDB,
                                           SxpDatabaseInf sxpDB); static SxpDomain createInstance(SxpNode owner,
            org.opendaylight.yang.gen.v1.urn.opendaylight.sxp.node.rev160308.network.topology.topology.node.sxp.domains.SxpDomain domain); Map<String, SxpBindingFilter<?, ? extends SxpDomainFilterFields>> getFilters(); boolean addFilter(SxpBindingFilter<?, ? extends SxpDomainFilterFields> filter); SxpBindingFilter<?, ? extends SxpDomainFilterFields> removeFilter(FilterSpecific specific, String name); boolean updateFilter(SxpBindingFilter<?, ? extends SxpDomainFilterFields> newFilter); void pushToSharedMasterDatabases(final List<T> removed, final List<T> added); void pushToSharedSxpDatabases(NodeId nodeIdRemote, SxpBindingFilter<?, ? extends SxpFilterFields> sxpFilter,
            List<SxpDatabaseBinding> removed, List<SxpDatabaseBinding> added); MasterDatabaseInf getMasterDatabase(); SxpDatabaseInf getSxpDatabase(); String getName(); List<SxpConnection> getConnections(); SxpConnection getConnection(InetSocketAddress address); boolean addConnectionTemplate(T template); SxpConnectionTemplateFields removeConnectionTemplate(IpPrefix templatePrefix); SxpConnectionTemplateFields getTemplate(InetSocketAddress address); Collection<SxpConnectionTemplateFields> getConnectionTemplates(); boolean hasConnection(InetSocketAddress address); SxpConnection putConnection(SxpConnection connection); SxpConnection removeConnection(InetSocketAddress address); @Override void close();  }