MCPcopy Create free account
hub / github.com/e2wugui/zeze / handle

Method handle

ZezeJava/ZezeJava/src/main/java/Zeze/Net/Rpc.java:284–311  ·  view source on GitHub ↗
(@NotNull Service service,
					   @NotNull Service.ProtocolFactoryHandle<?> factoryHandle)

Source from the content-addressed store, hash-verified

282 }
283
284 @Override
285 public long handle(@NotNull Service service,
286 @NotNull Service.ProtocolFactoryHandle<?> factoryHandle) throws Exception {
287 if (isRequest)
288 return super.handle(service, factoryHandle);
289
290 // response, 从上下文中查找原来发送的rpc对象,并派发该对象。
291 Rpc<TArgument, TResult> context = service.removeRpcContext(sessionId);
292 if (context == null) {
293 service.onRpcLostContext(this);
294 return 0;
295 }
296
297 Transaction.tryWhileRedo(() -> service.addRpcContext(sessionId, context));
298
299 context.setSender(getSender());
300 context.resultCode = resultCode;
301 context.Result = Result;
302 context.isTimeout = false; // not need
303 context.isRequest = false;
304
305 if (context.future != null)
306 context.future.setResult(context.Result); // SendForWait,设置结果唤醒等待者。
307 else if (context.responseHandle != null)
308 return context.responseHandle.handle(context);
309
310 return 0;
311 }
312
313 @Override
314 public void encode(@NotNull ByteBuffer bb) {

Callers

nothing calls this directly

Calls 8

tryWhileRedoMethod · 0.95
removeRpcContextMethod · 0.80
onRpcLostContextMethod · 0.80
addRpcContextMethod · 0.80
handleMethod · 0.65
getSenderMethod · 0.65
setSenderMethod · 0.45
setResultMethod · 0.45

Tested by

no test coverage detected