MCPcopy Index your code
hub / github.com/grpc/grpc-java / NettyClientHandler

Class NettyClientHandler

netty/src/main/java/io/grpc/netty/NettyClientHandler.java:102–1186  ·  view source on GitHub ↗

Client-side Netty handler for GRPC processing. All event handlers are executed entirely within the context of the Netty Channel thread.

Source from the content-addressed store, hash-verified

100 * the context of the Netty Channel thread.
101 */
102class NettyClientHandler extends AbstractNettyHandler {
103 private static final Logger logger = Logger.getLogger(NettyClientHandler.class.getName());
104 static boolean enablePerRpcAuthorityCheck =
105 GrpcUtil.getFlag("GRPC_ENABLE_PER_RPC_AUTHORITY_CHECK", false);
106
107 /**
108 * A message that simply passes through the channel without any real processing. It is useful to
109 * check if buffers have been drained and test the health of the channel in a single operation.
110 */
111 static final Object NOOP_MESSAGE = new Object();
112
113 /**
114 * Status used when the transport has exhausted the number of streams.
115 */
116 private static final Status EXHAUSTED_STREAMS_STATUS =
117 Status.UNAVAILABLE.withDescription("Stream IDs have been exhausted");
118 private static final long USER_PING_PAYLOAD = 1111;
119
120 private final Http2Connection.PropertyKey streamKey;
121 private final ClientTransportLifecycleManager lifecycleManager;
122 private final KeepAliveManager keepAliveManager;
123 // Returns new unstarted stopwatches
124 private final Supplier<Stopwatch> stopwatchFactory;
125 private final TransportTracer transportTracer;
126 private final Attributes eagAttributes;
127 private final TcpMetrics tcpMetrics;
128 private final String authority;
129 private final InUseStateAggregator<Http2Stream> inUseState =
130 new InUseStateAggregator<Http2Stream>() {
131 @Override
132 protected void handleInUse() {
133 lifecycleManager.notifyInUse(true);
134 }
135
136 @Override
137 protected void handleNotInUse() {
138 lifecycleManager.notifyInUse(false);
139 }
140 };
141 private final Map<String, Status> peerVerificationResults =
142 new LinkedHashMap<String, Status>() {
143 @Override
144 protected boolean removeEldestEntry(Map.Entry<String, Status> eldest) {
145 return size() > 100;
146 }
147 };
148
149 private WriteQueue clientWriteQueue;
150 private Http2Ping ping;
151 private Attributes attributes;
152 private InternalChannelz.Security securityInfo;
153 private Status abruptGoAwayStatus;
154 private Status channelInactiveReason;
155
156 static NettyClientHandler newHandler(
157 ClientTransportLifecycleManager lifecycleManager,
158 @Nullable KeepAliveManager keepAliveManager,
159 boolean autoFlowControl,

Callers

nothing calls this directly

Calls 3

getFlagMethod · 0.95
withDescriptionMethod · 0.80
getNameMethod · 0.65

Tested by

no test coverage detected