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

Method dispatch

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

Source from the content-addressed store, hash-verified

237 }
238
239 @Override
240 public void dispatch(@NotNull Service service,
241 @NotNull Service.ProtocolFactoryHandle<?> factoryHandle) throws Exception {
242 if (isRequest) {
243 super.dispatch(service, factoryHandle);
244 return;
245 }
246
247 // response, 从上下文中查找原来发送的rpc对象,并派发该对象。
248 var ctx = service.removeRpcContext(sessionId);
249 if (ctx == null) {
250 service.onRpcLostContext(this);
251 return;
252 }
253 var context = setupRpcResponseContext(ctx);
254 if (context.future != null)
255 context.future.setResult(context.Result); // SendForWait,设置结果唤醒等待者。
256 else if (context.responseHandle != null)
257 service.dispatchRpcResponse(context, context.responseHandle, factoryHandle);
258 }
259
260 public Rpc<TArgument, TResult> setupRpcResponseContext(@NotNull Protocol<?> ctx) {
261 @SuppressWarnings("unchecked")

Callers 9

dispatchProtocolMethod · 0.45
dispatchProtocolMethod · 0.45
dispatchProtocolMethod · 0.45
dispatchProtocolMethod · 0.45
dispatchProtocolMethod · 0.45
dispatchProtocolMethod · 0.45
dispatchProtocolMethod · 0.45
dispatchProtocolMethod · 0.45
dispatchProtocolMethod · 0.45

Calls 5

removeRpcContextMethod · 0.80
onRpcLostContextMethod · 0.80
setResultMethod · 0.45
dispatchRpcResponseMethod · 0.45

Tested by

no test coverage detected