Home / Function/ tearDown() — netty Function Reference

tearDown() — netty Function Reference

Architecture documentation for the tearDown() function in SSLEngineTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  c12eff1d_7dc1_df4d_6045_c955d85f1898["tearDown()"]
  9150c92a_2afc_b83a_c3bf_86dfac6e9d9b["SSLEngineTest"]
  c12eff1d_7dc1_df4d_6045_c955d85f1898 -->|defined in| 9150c92a_2afc_b83a_c3bf_86dfac6e9d9b
  e1102465_83a3_6c0b_df08_3edda5ec7992["cleanupServerSslContext()"]
  c12eff1d_7dc1_df4d_6045_c955d85f1898 -->|calls| e1102465_83a3_6c0b_df08_3edda5ec7992
  f6915f7b_bea2_ba4b_1048_139ec9ec9498["cleanupClientSslContext()"]
  c12eff1d_7dc1_df4d_6045_c955d85f1898 -->|calls| f6915f7b_bea2_ba4b_1048_139ec9ec9498
  style c12eff1d_7dc1_df4d_6045_c955d85f1898 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java lines 497–556

    @AfterEach
    public void tearDown() throws InterruptedException {
        ChannelFuture clientCloseFuture = null;
        ChannelFuture serverConnectedCloseFuture = null;
        ChannelFuture serverCloseFuture = null;
        if (clientChannel != null) {
            clientCloseFuture = clientChannel.close();
            clientChannel = null;
        }
        if (serverConnectedChannel != null) {
            serverConnectedCloseFuture = serverConnectedChannel.close();
            serverConnectedChannel = null;
        }
        if (serverChannel != null) {
            serverCloseFuture = serverChannel.close();
            serverChannel = null;
        }
        // We must wait for the Channel cleanup to finish. In the case if the ReferenceCountedOpenSslEngineTest
        // the ReferenceCountedOpenSslEngine depends upon the SslContext and so we must wait the cleanup the
        // SslContext to avoid JVM core dumps!
        //
        // See https://github.com/netty/netty/issues/5692
        if (clientCloseFuture != null) {
            clientCloseFuture.sync();
        }
        if (serverConnectedCloseFuture != null) {
            serverConnectedCloseFuture.sync();
        }
        if (serverCloseFuture != null) {
            serverCloseFuture.sync();
        }
        if (serverSslCtx != null) {
            cleanupServerSslContext(serverSslCtx);
            serverSslCtx = null;
        }
        if (clientSslCtx != null) {
            cleanupClientSslContext(clientSslCtx);
            clientSslCtx = null;
        }
        Future<?> serverGroupShutdownFuture = null;
        Future<?> serverChildGroupShutdownFuture = null;
        Future<?> clientGroupShutdownFuture = null;
        if (sb != null) {
            serverGroupShutdownFuture = sb.config().group().shutdownGracefully(0, 0, TimeUnit.MILLISECONDS);
            serverChildGroupShutdownFuture = sb.config().childGroup().shutdownGracefully(0, 0, TimeUnit.MILLISECONDS);
        }
        if (cb != null) {
            clientGroupShutdownFuture = cb.config().group().shutdownGracefully(0, 0, TimeUnit.MILLISECONDS);
        }
        if (serverGroupShutdownFuture != null) {
            serverGroupShutdownFuture.sync();
            serverChildGroupShutdownFuture.sync();
        }
        if (clientGroupShutdownFuture != null) {
            clientGroupShutdownFuture.sync();
        }
        assertTrue(delegatingExecutor.shutdownAndAwaitTermination(5, TimeUnit.SECONDS));
        serverException = null;
        clientException = null;
    }

Domain

Subdomains

Frequently Asked Questions

What does tearDown() do?
tearDown() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java.
Where is tearDown() defined?
tearDown() is defined in handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java at line 497.
What does tearDown() call?
tearDown() calls 2 function(s): cleanupClientSslContext, cleanupServerSslContext.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free