Skip to content

Commit

Permalink
fix remoteContext concurrency problem when msg batch handler
Browse files Browse the repository at this point in the history
  • Loading branch information
liujianjun.ljj committed Apr 27, 2024
1 parent cc33824 commit de363bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/main/java/com/alipay/remoting/RemotingContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* @author jiangping
* @version $Id: RemotingContext.java, v 0.1 2015-9-6 PM5:50:07 tao Exp $
*/
public class RemotingContext {
public class RemotingContext implements Cloneable{

private ChannelHandlerContext channelContext;

Expand Down Expand Up @@ -251,4 +251,8 @@ public RemotingContext setTimeoutDiscard(boolean failFastEnabled) {
this.timeoutDiscard = failFastEnabled;
return this;
}

public RemotingContext clone() {
return new RemotingContext(channelContext, new InvokeContext(), serverSide, userProcessors);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void run() {
logger.debug("Batch message! size={}", ((List<?>) msg).size());
}
for (final Object m : (List<?>) msg) {
RpcCommandHandler.this.process(ctx, m);
RpcCommandHandler.this.process(ctx.clone(), m);
}
}
};
Expand Down

0 comments on commit de363bf

Please sign in to comment.