| 构造器和说明 |
|---|
JsonRpcEngine(JsonImplementor jsonImpl) |
JsonRpcEngine(JsonImplementor jsonImpl,
BinaryWrapper binaryWrapper) |
| 限定符和类型 | 方法和说明 |
|---|---|
protected JsonRpcRequest |
createRequest(String serviceName,
String methodName,
Object[] args,
String id) |
protected JsonRpcResponse |
execute(JsonRpcRequest request)
处理远端的调用请求,执行相应的方法并返回执行结果。
|
protected <T> T |
fromResponse(JsonRpcResponse resp,
Type returnType) |
protected JsonImplementor |
getJsonImplementor() |
JsonRpcLogger |
getJsonRpcLogger() |
ServiceRegistry |
getServiceRegistry() |
void |
invoke(String serviceName,
String methodName,
Object[] args,
String id,
Transport transport)
远程调用方法。
|
protected JsonRpcMessage |
receive(byte[] bytes) |
protected JsonRpcMessage |
receive(byte[] bytes,
JsonRpcLogger logger) |
void |
receiveRequest(byte[] bytes,
Transport transport)
接收远端的调用请求,并将回复执行结果。
|
<T> T |
receiveResponse(byte[] bytes,
Type returnType)
接收远程调用得到的回复,从回复中返回指定类型的对象。
|
void |
setJsonRpcLogger(JsonRpcLogger jsonRpcLogger) |
protected void |
transmit(Transport transport,
JsonRpcMessage message) |
protected void |
transmit(Transport transport,
JsonRpcMessage message,
JsonRpcLogger logger) |
public JsonRpcEngine(JsonImplementor jsonImpl)
public JsonRpcEngine(JsonImplementor jsonImpl, BinaryWrapper binaryWrapper)
protected JsonImplementor getJsonImplementor()
JsonImplementor 对象public ServiceRegistry getServiceRegistry()
public JsonRpcLogger getJsonRpcLogger()
public void setJsonRpcLogger(JsonRpcLogger jsonRpcLogger)
public void invoke(String serviceName, String methodName, Object[] args, String id, Transport transport) throws IOException, JsonException
serviceName - 服务名methodName - 方法名args - 参数id - 请求IDtransport - Transport实例IOExceptionJsonExceptionprotected JsonRpcRequest createRequest(String serviceName, String methodName, Object[] args, String id)
public void receiveRequest(byte[] bytes,
Transport transport)
throws IOException,
JsonException
bytes - 接收到的数据transport - Transport 实例IOExceptionJsonExceptionpublic <T> T receiveResponse(byte[] bytes,
Type returnType)
throws IOException,
JsonException,
RemoteException
bytes - 接收到的字节数组returnType - 返回的对象类型IOException - IO错误JsonExceptionRemoteException - 远程方法抛出异常protected JsonRpcResponse execute(JsonRpcRequest request)
request - protected <T> T fromResponse(JsonRpcResponse resp, Type returnType) throws JsonException, RemoteException
protected JsonRpcMessage receive(byte[] bytes) throws IOException, JsonException
protected JsonRpcMessage receive(byte[] bytes, JsonRpcLogger logger) throws IOException, JsonException
protected void transmit(Transport transport, JsonRpcMessage message) throws IOException, JsonException
protected void transmit(Transport transport, JsonRpcMessage message, JsonRpcLogger logger) throws IOException, JsonException
Copyright © 2018. All rights reserved.