Home / Function/ acquire0() — netty Function Reference

acquire0() — netty Function Reference

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

Function java Buffer Search calls 5 called by 1

Entity Profile

Dependency Diagram

graph TD
  58ce3254_7910_e246_bd60_e2c3b0165bc0["acquire0()"]
  379a0f3e_d35d_8054_6f12_48a2cfebefb5["FixedChannelPool"]
  58ce3254_7910_e246_bd60_e2c3b0165bc0 -->|defined in| 379a0f3e_d35d_8054_6f12_48a2cfebefb5
  1d51fd53_2c69_0470_07c7_4631383a891c["acquire()"]
  1d51fd53_2c69_0470_07c7_4631383a891c -->|calls| 58ce3254_7910_e246_bd60_e2c3b0165bc0
  eeb76f34_1a17_d512_4712_7714228787a2["AcquireListener()"]
  58ce3254_7910_e246_bd60_e2c3b0165bc0 -->|calls| eeb76f34_1a17_d512_4712_7714228787a2
  0838d3b3_52a9_65c1_0d21_2ababab8d237["acquired()"]
  58ce3254_7910_e246_bd60_e2c3b0165bc0 -->|calls| 0838d3b3_52a9_65c1_0d21_2ababab8d237
  1d51fd53_2c69_0470_07c7_4631383a891c["acquire()"]
  58ce3254_7910_e246_bd60_e2c3b0165bc0 -->|calls| 1d51fd53_2c69_0470_07c7_4631383a891c
  a905bd75_f3aa_5ff9_a666_21be6688b3a8["tooManyOutstanding()"]
  58ce3254_7910_e246_bd60_e2c3b0165bc0 -->|calls| a905bd75_f3aa_5ff9_a666_21be6688b3a8
  8ea5e32e_1697_cb44_3c31_e1cdeb81d6aa["AcquireTask()"]
  58ce3254_7910_e246_bd60_e2c3b0165bc0 -->|calls| 8ea5e32e_1697_cb44_3c31_e1cdeb81d6aa
  style 58ce3254_7910_e246_bd60_e2c3b0165bc0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/main/java/io/netty/channel/pool/FixedChannelPool.java lines 244–284

    private void acquire0(final Promise<Channel> promise) {
        try {
            assert executor.inEventLoop();

            if (closed) {
                promise.setFailure(new IllegalStateException("FixedChannelPool was closed"));
                return;
            }
            if (acquiredChannelCount.get() < maxConnections) {
                assert acquiredChannelCount.get() >= 0;

                // We need to create a new promise as we need to ensure the AcquireListener runs in the correct
                // EventLoop
                Promise<Channel> p = executor.newPromise();
                AcquireListener l = new AcquireListener(promise);
                l.acquired();
                p.addListener(l);
                super.acquire(p);
            } else {
                if (pendingAcquireCount >= maxPendingAcquires) {
                    tooManyOutstanding(promise);
                } else {
                    AcquireTask task = new AcquireTask(promise);
                    if (pendingAcquireQueue.offer(task)) {
                        ++pendingAcquireCount;

                        if (timeoutTask != null) {
                            task.timeoutFuture = executor.schedule(timeoutTask, acquireTimeoutNanos,
                                  TimeUnit.NANOSECONDS);
                        }
                    } else {
                        tooManyOutstanding(promise);
                    }
                }

                assert pendingAcquireCount > 0;
            }
        } catch (Throwable cause) {
            promise.tryFailure(cause);
        }
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does acquire0() do?
acquire0() is a function in the netty codebase, defined in transport/src/main/java/io/netty/channel/pool/FixedChannelPool.java.
Where is acquire0() defined?
acquire0() is defined in transport/src/main/java/io/netty/channel/pool/FixedChannelPool.java at line 244.
What does acquire0() call?
acquire0() calls 5 function(s): AcquireListener, AcquireTask, acquire, acquired, tooManyOutstanding.
What calls acquire0()?
acquire0() is called by 1 function(s): acquire.

Analyze Your Own Codebase

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

Try Supermodel Free