Skip to content

Commit

Permalink
Remove thread local message frame to fix the connection close issue
Browse files Browse the repository at this point in the history
  • Loading branch information
daneshk committed Dec 5, 2024
1 parent 057624b commit 630d8a7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ public class OutboundMessage {
private final HttpCarbonMessage responseMessage;
private int statusCode = NULL_STATUS_CODE;
private boolean outboundClosed;
private final ThreadLocal<MessageFramer> framer;
private final MessageFramer framer;

public OutboundMessage(HttpCarbonMessage responseMessage) {
this.responseMessage = responseMessage;
this.framer = ThreadLocal.withInitial(() -> new MessageFramer(responseMessage));
this.framer = new MessageFramer(responseMessage);
}

OutboundMessage(InboundMessage inboundMessage) {
Expand All @@ -68,7 +68,7 @@ public OutboundMessage(HttpCarbonMessage responseMessage) {
responseMessage.setHeader(CONTENT_TYPE_KEY, GrpcConstants.CONTENT_TYPE_GRPC);
responseMessage.setHeader(TE_KEY, GrpcConstants.TE_TRAILERS);
this.responseMessage = responseMessage;
this.framer = ThreadLocal.withInitial(() -> new MessageFramer(responseMessage));
this.framer = new MessageFramer(responseMessage);
}

/**
Expand Down Expand Up @@ -237,7 +237,7 @@ final void halfClose() {
}

final MessageFramer framer() {
return framer.get();
return framer;
}

public boolean isReady() {
Expand Down

0 comments on commit 630d8a7

Please sign in to comment.