@InterfaceAudience.Private public class Rpc extends Object implements Closeable
Modifier and Type | Class and Description |
---|---|
static interface |
Rpc.Listener |
Modifier and Type | Method and Description |
---|---|
void |
addListener(Rpc.Listener l) |
io.netty.util.concurrent.Future<Void> |
call(Object msg)
Send an RPC call to the remote endpoint and returns a future that can be used to monitor the
operation.
|
<T> io.netty.util.concurrent.Future<T> |
call(Object msg,
Class<T> retType)
Send an RPC call to the remote endpoint and returns a future that can be used to monitor the
operation.
|
void |
close() |
static io.netty.util.concurrent.Promise<Rpc> |
createClient(Map<String,String> config,
io.netty.channel.nio.NioEventLoopGroup eloop,
String host,
int port,
String clientId,
String secret,
RpcDispatcher dispatcher)
Creates an RPC client for a server running on the given remote host and port.
|
<T> io.netty.util.concurrent.Promise<T> |
createPromise()
Creates a promise backed by this RPC's event loop.
|
public static io.netty.util.concurrent.Promise<Rpc> createClient(Map<String,String> config, io.netty.channel.nio.NioEventLoopGroup eloop, String host, int port, String clientId, String secret, RpcDispatcher dispatcher) throws Exception
config
- RPC configuration data.eloop
- Event loop for managing the connection.host
- Host name or IP address to connect to.port
- Port where server is listening.clientId
- The client ID that identifies the connection.secret
- Secret for authenticating the client with the server.dispatcher
- Dispatcher used to handle RPC calls.Exception
public void addListener(Rpc.Listener l)
public io.netty.util.concurrent.Future<Void> call(Object msg)
public <T> io.netty.util.concurrent.Future<T> call(Object msg, Class<T> retType)
msg
- RPC call to send.retType
- Type of expected reply.public <T> io.netty.util.concurrent.Promise<T> createPromise()
public void close()
close
in interface Closeable
close
in interface AutoCloseable
Copyright © 2017 The Apache Software Foundation. All rights reserved.