//TODO:Until the listener is set, content writing happens in I/O thread. If writability changed
//while in I/O thread and DefaultBackPressureListener is engaged, there's a chance of I/O thread
//getting blocked. Cannot recreate, only a possibility.
public void writeContent(HttpCarbonMessage httpOutboundRequest) {
        if (handlerExecutor != null) {
            handlerExecutor.executeAtTargetRequestReceiving(httpOutboundRequest);
        }
        BackPressureHandler backpressureHandler = Util.getBackPressureHandler(targetHandler.getContext());
        Util.setBackPressureListener(httpOutboundRequest, backpressureHandler, httpOutboundRequest.getSourceContext());
        resetTargetChannelState();
        httpOutboundRequest.getHttpContentAsync().setMessageListener((httpContent -> {
            //TODO:Until the listener is set, content writing happens in I/O thread. If writability changed
            //while in I/O thread and DefaultBackPressureListener is engaged, there's a chance of I/O thread
            //getting blocked. Cannot recreate, only a possibility.
            Util.checkUnWritabilityAndNotify(targetHandler.getContext(), backpressureHandler);
            this.channel.eventLoop().execute(() -> {
                try {
                    senderReqRespStateManager.writeOutboundRequestEntity(httpOutboundRequest, httpContent);
                } catch (Exception exception) {
                    String errorMsg = "Failed to send the request : "
                            + exception.getMessage().toLowerCase(Locale.ENGLISH);
                    LOG.error(errorMsg, exception);
                    this.targetHandler.getHttpResponseFuture().notifyHttpListener(exception);
                }
            });
        }));
    }
resetTargetChannelState();
httpOutboundRequest.getHttpContentAsync().setMessageListener((httpContent -> {
//TODO:Until the listener is set, content writing happens in I/O thread. If writability changed
//while in I/O thread and DefaultBackPressureListener is engaged, there's a chance of I/O thread
//getting blocked. Cannot recreate, only a possibility.
Util.checkUnWritabilityAndNotify(targetHandler.getContext(), backpressureHandler);
this.channel.eventLoop().execute(() -> {
public void writeContent(HttpCarbonMessage httpOutboundRequest) {
if (handlerExecutor != null) {
handlerExecutor.executeAtTargetRequestReceiving(httpOutboundRequest);
}
BackPressureHandler backpressureHandler = Util.getBackPressureHandler(targetHandler.getContext());
Util.setBackPressureListener(httpOutboundRequest, backpressureHandler, httpOutboundRequest.getSourceContext());
resetTargetChannelState();
httpOutboundRequest.getHttpContentAsync().setMessageListener((httpContent -> {
//TODO:Until the listener is set, content writing happens in I/O thread. If writability changed
//while in I/O thread and DefaultBackPressureListener is engaged, there's a chance of I/O thread
//getting blocked. Cannot recreate, only a possibility.
Util.checkUnWritabilityAndNotify(targetHandler.getContext(), backpressureHandler);
this.channel.eventLoop().execute(() -> {
try {
senderReqRespStateManager.writeOutboundRequestEntity(httpOutboundRequest, httpContent);
} catch (Exception exception) {
String errorMsg = "Failed to send the request : "
+ exception.getMessage().toLowerCase(Locale.ENGLISH);
LOG.error(errorMsg, exception);
this.targetHandler.getHttpResponseFuture().notifyHttpListener(exception);
}
public void writeContent(HttpCarbonMessage httpOutboundRequest) {
if (handlerExecutor != null) {
handlerExecutor.executeAtTargetRequestReceiving(httpOutboundRequest);
}
BackPressureHandler backpressureHandler = Util.getBackPressureHandler(targetHandler.getContext());
Util.setBackPressureListener(httpOutboundRequest, backpressureHandler, httpOutboundRequest.getSourceContext());
resetTargetChannelState();
httpOutboundRequest.getHttpContentAsync().setMessageListener((httpContent -> {
//TODO:Until the listener is set, content writing happens in I/O thread. If writability changed
//while in I/O thread and DefaultBackPressureListener is engaged, there's a chance of I/O thread
//getting blocked. Cannot recreate, only a possibility.
Util.checkUnWritabilityAndNotify(targetHandler.getContext(), backpressureHandler);
this.channel.eventLoop().execute(() -> {
try {
senderReqRespStateManager.writeOutboundRequestEntity(httpOutboundRequest, httpContent);
} catch (Exception exception) {
String errorMsg = "Failed to send the request : "
+ exception.getMessage().toLowerCase(Locale.ENGLISH);
LOG.error(errorMsg, exception);
this.targetHandler.getHttpResponseFuture().notifyHttpListener(exception);
}
});
}));
}