public class JsonRpcControl extends Object implements ServiceRegistry
| 限定符 | 构造器和说明 |
|---|---|
|
JsonRpcControl(JsonImplementor jsonImpl)
创建JsonRpcControl
|
protected |
JsonRpcControl(JsonImplementor jsonImpl,
BinaryWrapper binaryWrapper) |
| 限定符和类型 | 方法和说明 |
|---|---|
protected <T> T |
convertResponse(JsonRpcResponse resp,
Class<T> returnType) |
JsonRpcResponse |
execute(JsonRpcRequest request)
处理远端的调用请求,执行相应的方法并返回执行结果。
|
protected Method |
findExecutableMethod(Set<Method> methods,
JsonImplementor.Node[] params) |
JsonImplementor |
getJsonImplementor() |
protected Object[] |
getParameters(Method method,
JsonImplementor.Node[] params) |
void |
invoke(String serviceName,
String methodName,
Object[] args,
String id,
Transport transport)
远程调用方法。
|
protected JsonRpcMessage |
receive(byte[] bytes) |
void |
receiveRequest(byte[] bytes,
Transport transport)
接收远端的调用请求,并将回复执行结果。
|
<T> T |
receiveResponse(byte[] bytes,
Class<T> returnType)
接收远程调用得到的回复,从回复中返回指定类型的对象。
|
<T> ServiceRegistry |
register(String name,
T service,
Class<?>... classes) |
protected void |
transmit(Transport transport,
JsonRpcMessage message) |
ServiceRegistry |
unregister(String name) |
public JsonRpcControl(JsonImplementor jsonImpl)
jsonImpl - JsonImplementor 对象protected JsonRpcControl(JsonImplementor jsonImpl, BinaryWrapper binaryWrapper)
public JsonImplementor getJsonImplementor()
JsonImplementor 对象public <T> ServiceRegistry register(String name, T service, Class<?>... classes)
register 在接口中 ServiceRegistrypublic ServiceRegistry unregister(String name)
unregister 在接口中 ServiceRegistrypublic void receiveRequest(byte[] bytes,
Transport transport)
throws IOException,
WsonrpcException
bytes - 接收到的数据transport - Transport 实例IOException - IOExceptionWsonrpcException - WsonrpcExceptionpublic <T> T receiveResponse(byte[] bytes,
Class<T> returnType)
throws IOException,
WsonrpcException
bytes - 接收到的字节数组returnType - 返回的对象类型IOException - IOExceptionWsonrpcException - WsonrpcExceptionpublic void invoke(String serviceName, String methodName, Object[] args, String id, Transport transport) throws IOException, WsonrpcException
serviceName - 服务名methodName - 方法名args - 参数id - 请求IDtransport - Transport实例IOException - IOExceptionWsonrpcException - WsonrpcExceptionpublic JsonRpcResponse execute(JsonRpcRequest request)
request - JsonRpc请求protected Method findExecutableMethod(Set<Method> methods, JsonImplementor.Node[] params)
protected Object[] getParameters(Method method, JsonImplementor.Node[] params)
protected <T> T convertResponse(JsonRpcResponse resp, Class<T> returnType) throws WsonrpcException
WsonrpcExceptionprotected void transmit(Transport transport, JsonRpcMessage message) throws IOException, WsonrpcException
protected JsonRpcMessage receive(byte[] bytes) throws IOException, WsonrpcException
Copyright © 2016. All rights reserved.