@Override public Future<Boolean> isHealthy(Channel channel) { // See if we've marked the channel as being non-usable first. if (channelIsMarkedAsBeingBroken(channel)) return channel.eventLoop().newSucceededFuture(Boolean.FALSE); // We haven't marked it broken, so fallback to the default channel health checker. return ChannelHealthChecker.ACTIVE.isHealthy(channel); } }
@Override public Future<Boolean> isHealthy(Channel channel) { // See if we've marked the channel as being non-usable first. if (channelIsMarkedAsBeingBroken(channel)) return channel.eventLoop().newSucceededFuture(Boolean.FALSE); // We haven't marked it broken, so fallback to the default channel health checker. return ChannelHealthChecker.ACTIVE.isHealthy(channel); } }
protected static void markChannelBrokenAndLogInfoIfHttpClientCodecStateIsNotZero(Channel ch, String callContextForLogs) { HttpClientCodec currentCodec = (HttpClientCodec) ch.pipeline().get(HTTP_CLIENT_CODEC_HANDLER_NAME); if (currentCodec != null) { int currentHttpClientCodecInboundState = determineHttpClientCodecInboundState(currentCodec); if (currentHttpClientCodecInboundState != 0) { boolean channelAlreadyBroken = channelIsMarkedAsBeingBroken(ch); logger.warn( "HttpClientCodec inbound state was not 0. The channel will be marked as broken so it won't be " + "used. bad_httpclientcodec_inbound_state={}, channel_already_broken={}, channel_id={}, " + "call_context=\"{}\"", currentHttpClientCodecInboundState, channelAlreadyBroken, ch.toString(), callContextForLogs ); markChannelAsBroken(ch); } else { int currentHttpClientCodecOutboundState = determineHttpClientCodecOutboundState(currentCodec); if (currentHttpClientCodecOutboundState != 0) { boolean channelAlreadyBroken = channelIsMarkedAsBeingBroken(ch); logger.warn( "HttpClientCodec outbound state was not 0. The channel will be marked as broken so it won't be " + "used. bad_httpclientcodec_outbound_state={}, channel_already_broken={}, channel_id={}, " + "call_context=\"{}\"", currentHttpClientCodecOutboundState, channelAlreadyBroken, ch.toString(), callContextForLogs ); markChannelAsBroken(ch); } } } }
protected static void markChannelBrokenAndLogInfoIfHttpClientCodecStateIsNotZero(Channel ch, String callContextForLogs) { HttpClientCodec currentCodec = (HttpClientCodec) ch.pipeline().get(HTTP_CLIENT_CODEC_HANDLER_NAME); if (currentCodec != null) { int currentHttpClientCodecInboundState = determineHttpClientCodecInboundState(currentCodec); if (currentHttpClientCodecInboundState != 0) { boolean channelAlreadyBroken = channelIsMarkedAsBeingBroken(ch); logger.warn( "HttpClientCodec inbound state was not 0. The channel will be marked as broken so it won't be " + "used. bad_httpclientcodec_inbound_state={}, channel_already_broken={}, channel_id={}, " + "call_context=\"{}\"", currentHttpClientCodecInboundState, channelAlreadyBroken, ch.toString(), callContextForLogs ); markChannelAsBroken(ch); } else { int currentHttpClientCodecOutboundState = determineHttpClientCodecOutboundState(currentCodec); if (currentHttpClientCodecOutboundState != 0) { boolean channelAlreadyBroken = channelIsMarkedAsBeingBroken(ch); logger.warn( "HttpClientCodec outbound state was not 0. The channel will be marked as broken so it won't be " + "used. bad_httpclientcodec_outbound_state={}, channel_already_broken={}, channel_id={}, " + "call_context=\"{}\"", currentHttpClientCodecOutboundState, channelAlreadyBroken, ch.toString(), callContextForLogs ); markChannelAsBroken(ch); } } } }