Skip to content

Commit a785045

Browse files
author
yzhfd
committed
优化注释
1 parent 5fa4dd3 commit a785045

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

trpc-proto/trpc-proto-http/src/main/java/com/tencent/trpc/proto/http/server/AbstractHttpExecutor.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,9 @@ private void invokeRpcRequest(ProviderInvoker<?> invoker, DefRequest rpcRequest,
138138

139139
workerPool.execute(() -> {
140140
try {
141+
// Get the original http response
141142
HttpServletResponse response = getOriginalResponse(rpcRequest);
142-
143+
// Invoke the routing implementation method to handle the request.
143144
CompletionStage<Response> rpcFuture = invoker.invoke(rpcRequest);
144145

145146
rpcFuture.whenComplete((result, throwable) -> {
@@ -148,14 +149,18 @@ private void invokeRpcRequest(ProviderInvoker<?> invoker, DefRequest rpcRequest,
148149
return;
149150
}
150151

152+
// Throw the call exception, which will be handled uniformly by the exception handling program.
151153
if (throwable != null) {
152154
throw throwable;
153155
}
154156

157+
// Throw a business logic exception, which will be handled uniformly
158+
// by the exception handling program.
155159
if (result.getException() != null) {
156160
throw result.getException();
157161
}
158162

163+
// normal response
159164
if (responded.compareAndSet(false, true)) {
160165
response.setStatus(HttpStatus.SC_OK);
161166
httpCodec.writeHttpResponse(response, result);

0 commit comments

Comments
 (0)