Skip to content

Commit

Permalink
modify api for expand (sofastack#1229)
Browse files Browse the repository at this point in the history
* modify api for expand

Co-authored-by: liujianjun.ljj <[email protected]>
  • Loading branch information
EvenLjj and liujianjun.ljj authored Aug 24, 2022
1 parent 169016c commit fa6d366
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -703,4 +703,10 @@ public class RpcConstants {
*/
public static final String CUSTOM_CALLER_APP = "custom_caller_app";

/**
* RpcRequestCommand 对象
*/
public static final String INTERNAL_KEY_RPC_REQUEST_COMMAND = INTERNAL_KEY_PREFIX +
"rpc_request_command";

}
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public String httpGet(String path) {
return result;
}

private String httpPost(String path, String json) {
protected String httpPost(String path, String json) {
HttpURLConnection con = null;
String result = null;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
import com.alipay.sofa.rpc.transport.AbstractByteBuf;
import com.alipay.sofa.rpc.transport.ByteArrayWrapperByteBuf;

import static com.alipay.sofa.rpc.common.RpcConstants.INTERNAL_KEY_RPC_REQUEST_COMMAND;

/**
* Sofa RPC BOLT 协议的对象序列化/反序列化自定义类
*
Expand Down Expand Up @@ -194,6 +196,7 @@ public <Request extends RequestCommand> boolean serializeContent(Request request
throws SerializationException {
if (request instanceof RpcRequestCommand) {
RpcRequestCommand requestCommand = (RpcRequestCommand) request;
RpcInvokeContext.getContext().put(INTERNAL_KEY_RPC_REQUEST_COMMAND, requestCommand);
Object requestObject = requestCommand.getRequestObject();
byte serializerCode = requestCommand.getSerializer();
long serializeStartTime = System.nanoTime();
Expand All @@ -215,6 +218,7 @@ public <Request extends RequestCommand> boolean serializeContent(Request request
} finally {
// R5:record request serialization time
recordSerializeRequest(requestCommand, invokeContext, serializeStartTime);
RpcInvokeContext.getContext().remove(INTERNAL_KEY_RPC_REQUEST_COMMAND);
}
}
return false;
Expand Down

0 comments on commit fa6d366

Please sign in to comment.