Home / Function/ awaitResponses() — netty Function Reference

awaitResponses() — netty Function Reference

Architecture documentation for the awaitResponses() function in HttpResponseHandler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  d0c83892_0140_a4ea_6a94_4c83b599410d["awaitResponses()"]
  3bbd42a8_8af4_e370_e14a_958c09fd930b["HttpResponseHandler"]
  d0c83892_0140_a4ea_6a94_4c83b599410d -->|defined in| 3bbd42a8_8af4_e370_e14a_958c09fd930b
  style d0c83892_0140_a4ea_6a94_4c83b599410d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

example/src/main/java/io/netty/example/http2/helloworld/client/HttpResponseHandler.java lines 66–87

    public void awaitResponses(long timeout, TimeUnit unit) {
        Iterator<Entry<Integer, Entry<ChannelFuture, ChannelPromise>>> itr = streamidPromiseMap.entrySet().iterator();
        while (itr.hasNext()) {
            Entry<Integer, Entry<ChannelFuture, ChannelPromise>> entry = itr.next();
            ChannelFuture writeFuture = entry.getValue().getKey();
            if (!writeFuture.awaitUninterruptibly(timeout, unit)) {
                throw new IllegalStateException("Timed out waiting to write for stream id " + entry.getKey());
            }
            if (!writeFuture.isSuccess()) {
                throw new RuntimeException(writeFuture.cause());
            }
            ChannelPromise promise = entry.getValue().getValue();
            if (!promise.awaitUninterruptibly(timeout, unit)) {
                throw new IllegalStateException("Timed out waiting for response on stream id " + entry.getKey());
            }
            if (!promise.isSuccess()) {
                throw new RuntimeException(promise.cause());
            }
            System.out.println("---Stream id: " + entry.getKey() + " received---");
            itr.remove();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does awaitResponses() do?
awaitResponses() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/http2/helloworld/client/HttpResponseHandler.java.
Where is awaitResponses() defined?
awaitResponses() is defined in example/src/main/java/io/netty/example/http2/helloworld/client/HttpResponseHandler.java at line 66.

Analyze Your Own Codebase

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

Try Supermodel Free