diff --git "a/RPC\346\240\270\345\277\203\345\212\237\350\203\275\344\273\243\347\240\201\344\272\214.md" "b/RPC\346\240\270\345\277\203\345\212\237\350\203\275\344\273\243\347\240\201\344\272\214.md" index c39e7a42ee52d9375a9f92671e774e1e763ebea8..d6c21873fe925fe1d5289a38a82bff1f890f1808 100644 --- "a/RPC\346\240\270\345\277\203\345\212\237\350\203\275\344\273\243\347\240\201\344\272\214.md" +++ "b/RPC\346\240\270\345\277\203\345\212\237\350\203\275\344\273\243\347\240\201\344\272\214.md" @@ -122,14 +122,40 @@ public class OperateSignal implements SignalHandler { } } - + + + +// RequestFilter +public void filter(RpcContext context) throws Exception { + if (zzscfContext.getServerState() == ServerStateType.Reboot && (protocol.getPlatformType() == PlatformType.Java || protocol.getPlatformType() == PlatformType.PHP)) { + RpcResponse response = new RpcResponse(); + ResetProtocol rp = new ResetProtocol(); + rp.setMsg("This server is reboot!"); + responseProtocol.setSdpEntity(rp); + responseProtocol.setSDPType(SDPType.Reset); + response.setResponseBuffer(responseProtocol.toBytes(false, null)); + context.setRpcResponse(response); + context.setExecFilter(ExecFilterType.None); + context.setDoInvoke(false); + } +} + + + + public Object innerInvoke(RpcContext context, MethodSignature methodSignature) throws Exception { requestFilter(context); logger.debug("------------------------------ begin request-----------------------------"); Object response = null; RpcContext.setThreadLocal(context) - ... - ... + + //判断是否需要Invoke,在filter中被设置 + if (context.isDoInvoke()) { + //反射调用实际处理方法逻辑 + ...... + ...... + } + context.getResponseProtocol().setSdpEntity(response); responseFilter(context); RpcContext.clear(); @@ -146,20 +172,7 @@ protected void requestFilter(RpcContext context) throws Exception { logger.debug("end requestFilters"); } -// RequestFilter -public void filter(RpcContext context) throws Exception { - if (zzscfContext.getServerState() == ServerStateType.Reboot && (protocol.getPlatformType() == PlatformType.Java || protocol.getPlatformType() == PlatformType.PHP)) { - RpcResponse response = new RpcResponse(); - ResetProtocol rp = new ResetProtocol(); - rp.setMsg("This server is reboot!"); - responseProtocol.setSdpEntity(rp); - responseProtocol.setSDPType(SDPType.Reset); - response.setResponseBuffer(responseProtocol.toBytes(false, null)); - context.setRpcResponse(response); - context.setExecFilter(ExecFilterType.None); - context.setDoInvoke(false); - } -} +