Home / Function/ release() — netty Function Reference

release() — netty Function Reference

Architecture documentation for the release() function in FixedChannelPool.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  315745f1_dcf7_b5f2_a7bf_6256c54b99a0["release()"]
  379a0f3e_d35d_8054_6f12_48a2cfebefb5["FixedChannelPool"]
  315745f1_dcf7_b5f2_a7bf_6256c54b99a0 -->|defined in| 379a0f3e_d35d_8054_6f12_48a2cfebefb5
  9ac1ba40_078b_abc6_6da9_14f7a9e33ed8["close()"]
  315745f1_dcf7_b5f2_a7bf_6256c54b99a0 -->|calls| 9ac1ba40_078b_abc6_6da9_14f7a9e33ed8
  21d08587_1275_d708_de67_34ff59c3d946["decrementAndRunTaskQueue()"]
  315745f1_dcf7_b5f2_a7bf_6256c54b99a0 -->|calls| 21d08587_1275_d708_de67_34ff59c3d946
  style 315745f1_dcf7_b5f2_a7bf_6256c54b99a0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/main/java/io/netty/channel/pool/FixedChannelPool.java lines 290–321

    @Override
    public Future<Void> release(final Channel channel, final Promise<Void> promise) {
        ObjectUtil.checkNotNull(promise, "promise");
        final Promise<Void> p = executor.newPromise();
        super.release(channel, p.addListener((FutureListener<Void>) future -> {
            try {
                assert executor.inEventLoop();

                if (closed) {
                    // Since the pool is closed, we have no choice but to close the channel
                    channel.close();
                    promise.setFailure(new IllegalStateException("FixedChannelPool was closed"));
                    return;
                }

                if (future.isSuccess()) {
                    decrementAndRunTaskQueue();
                    promise.setSuccess(null);
                } else {
                    Throwable cause = future.cause();
                    // Check if the exception was not because of we passed the Channel to the wrong pool.
                    if (!(cause instanceof IllegalArgumentException)) {
                        decrementAndRunTaskQueue();
                    }
                    promise.setFailure(future.cause());
                }
            } catch (Throwable cause) {
                promise.tryFailure(cause);
            }
        }));
        return promise;
    }

Domain

Subdomains

Frequently Asked Questions

What does release() do?
release() is a function in the netty codebase, defined in transport/src/main/java/io/netty/channel/pool/FixedChannelPool.java.
Where is release() defined?
release() is defined in transport/src/main/java/io/netty/channel/pool/FixedChannelPool.java at line 290.
What does release() call?
release() calls 2 function(s): close, decrementAndRunTaskQueue.

Analyze Your Own Codebase

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

Try Supermodel Free