public class Connector extends Object implements IoServiceUtils.Configuration
| Modifier and Type | Field and Description |
|---|---|
protected InetSocketAddress |
address
Listening address.
|
protected org.apache.mina.transport.socket.nio.NioSocketConnector |
connector
Connector itself.
|
static int |
DEFAULT_PACKET_LIMIT
Default packet size limit.
|
protected RequestIoHandler |
handler
JSON-RCP handler.
|
protected org.slf4j.Logger |
logger
Logger.
|
protected int |
maxPacketSize
Maximum size of JSON-RPC packet.
|
| Constructor and Description |
|---|
Connector(org.apache.mina.transport.socket.nio.NioSocketConnector connector,
RequestIoHandler handler,
InetSocketAddress address)
Initializes connector with given configuration.
|
| Modifier and Type | Method and Description |
|---|---|
org.apache.mina.core.future.ConnectFuture |
connect()
Connects to server.
|
static Connector |
create(InetSocketAddress address)
Creates connector instance with default resources.
|
void |
dispose()
Releases all resources.
|
protected Object |
execute(FutureTask<com.thetransactioncompany.jsonrpc2.JSONRPC2Response> future)
Executes queued RPC call.
|
Object |
execute(String method)
Executes remote call without parameters.
|
Object |
execute(String method,
Map<String,Object> params)
Executes remote call with parameters.
|
int |
getMaxPacketSize()
Returns size of maximum JSON-RPC packet size.
|
void |
setMaxPacketSize(int maxPacketSize)
Sets max JSON-RPC packet size.
|
public static final int DEFAULT_PACKET_LIMIT
protected org.slf4j.Logger logger
protected InetSocketAddress address
protected int maxPacketSize
protected org.apache.mina.transport.socket.nio.NioSocketConnector connector
protected RequestIoHandler handler
public Connector(org.apache.mina.transport.socket.nio.NioSocketConnector connector,
RequestIoHandler handler,
InetSocketAddress address)
connector - Socket connector.handler - JSON-RPC request handler.address - Listening address.public void setMaxPacketSize(int maxPacketSize)
maxPacketSize - Packet size in bytes.public int getMaxPacketSize()
getMaxPacketSize in interface IoServiceUtils.Configurationpublic Object execute(String method) throws ExecutionException, com.thetransactioncompany.jsonrpc2.JSONRPC2Error
method - Method name.ExecutionException - When execution fails on client side or due to a connection.com.thetransactioncompany.jsonrpc2.JSONRPC2Error - When execution fails on server side.public Object execute(String method, Map<String,Object> params) throws ExecutionException, com.thetransactioncompany.jsonrpc2.JSONRPC2Error
method - Method name.params - RPC params.ExecutionException - When execution fails on client side or due to a connection.com.thetransactioncompany.jsonrpc2.JSONRPC2Error - When execution fails on server side.protected Object execute(FutureTask<com.thetransactioncompany.jsonrpc2.JSONRPC2Response> future) throws ExecutionException, com.thetransactioncompany.jsonrpc2.JSONRPC2Error
future - Response fetcher future.ExecutionException - When execution fails on client side or due to a connection.com.thetransactioncompany.jsonrpc2.JSONRPC2Error - When execution fails on server side.public org.apache.mina.core.future.ConnectFuture connect()
public void dispose()
public static Connector create(InetSocketAddress address)
address - Server address.Copyright © 2015 RafaĆ Wrzeszcz - Wrzasq.pl. All rights reserved.