Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
* ACK flag : (0=Don't need, 1=Need)
* Request Packet (note: 1 = request type)
* -+------8B--------+--1B--+--1B--+------4B------+-----4B-----+-----4B-----+------1B--------+-----length-----+------1B-------+---length----+-----4B------+-------length-------------+
* | header/version | type | ACK | total length | Request ID | timeout/ms | service length | service name | method length | method name | data length | data |
* | NRPC/010 | 1 | 1 | 55 | 1 | 1000 | 8 | "/sys/user" | 7 | getUser | 24 | {"age":10,"name":"wang"} |
* -+----------------+------+------+--------------+------------+------------+----------------+----------------+---------------+-------------+-------------+--------------------------+
*
*
* Response Packet (note: 2 = response type)
* -+------8B--------+--1B--+--1B--+------4B------+-----4B-----+---2B---+--------1B------+--length--+---1B---+-----4B------+----------length----------+
* | header/version | type | ACK | total length | Request ID | status | message length | message | encode | data length | data |
* | NRPC/010 | 2 | 0 | 35 | 1 | 200 | 2 | ok | 1 | 24 | {"age":10,"name":"wang"} |
* -+----------------+------+------+--------------+------------+--------+----------------+----------+--------+-------------+--------------------------+
*
*
* -+------2B-------+--1B--+----1B----+-----8B-----+------1B-----+----------------dynamic---------------------+-------dynamic------------+
* | packet length | type | ACK flag | version | Fields size | Fields | Body |
* | 76 | 1 | 1 | NRPC/201 | 2 | 11requestMappingName6/hello10methodName8sayHello | {"age":10,"name":"wang"} |
* -+---------------+------+----------+------------+-------------+--------------------------------------------+--------------------------+
*
* @author wangzihao
* 2018/11/25/025
*/
public class NRpcProtocol extends AbstractProtocol {
private final List rpcServerAopList = new ArrayList<>();
private final AnnotationMethodToMethodNameFunction annotationMethodToMethodNameFunction = new AnnotationMethodToMethodNameFunction(NRpcMethod.class);
private final LoggerX logger = LoggerFactoryX.getLogger(getClass());
private final ApplicationX application;
private Supplier executorSupplier;
/**
* Maximum message length per pass
*/
private int messageMaxLength = 10 * 1024 * 1024;
/**
* Check the method of the same name (because the generalization parameter called allow inconsistent,
* so the name of the method to ensure that each class is unique)
*/
private boolean methodOverwriteCheck = true;
private final Map