/** * * @param key RpcConnectionKey * @param <T> Rpc Protocol Class * @return Rpc Client Class * @throws NoSuchMethodException * @throws ClassNotFoundException * @throws ConnectException */ public synchronized <T extends NettyClientBase> T newClient(RpcConnectionKey key, Properties connectionParameters) throws NoSuchMethodException, ClassNotFoundException, ConnectException { T client = makeClient(key, connectionParameters); client.connect(); assert client.isConnected(); return client; }
/** * * @param key RpcConnectionKey * @param <T> Rpc Protocol Class * @return Rpc Client Class * @throws NoSuchMethodException * @throws ClassNotFoundException * @throws ConnectException */ public synchronized <T extends NettyClientBase> T newClient(RpcConnectionKey key, Properties connectionParameters) throws NoSuchMethodException, ClassNotFoundException, ConnectException { T client = makeClient(key, connectionParameters); client.connect(); assert client.isConnected(); return client; }
public synchronized <T extends NettyClientBase> T newBlockingClient(InetSocketAddress addr, Class<?> protocolClass, EventLoopGroup eventLoopGroup, Properties rpcParams) throws NoSuchMethodException, ClassNotFoundException, ConnectException { T client = makeClient(eventLoopGroup, new RpcConnectionKey(addr, protocolClass, false), rpcParams); client.connect(); assert client.isConnected(); return client; }
public synchronized <T extends NettyClientBase> T newBlockingClient(InetSocketAddress addr, Class<?> protocolClass, EventLoopGroup eventLoopGroup, Properties rpcParams) throws NoSuchMethodException, ClassNotFoundException, ConnectException { T client = makeClient(eventLoopGroup, new RpcConnectionKey(addr, protocolClass, false), rpcParams); client.connect(); assert client.isConnected(); return client; }
/** * Connect a {@link NettyClientBase} to the remote {@link NettyServerBase}, and returns rpc client by protocol. * This client will be shared per protocol and address. Client is removed in shared map when a client is closed * @param addr * @param protocolClass * @param asyncMode * @return * @throws NoSuchMethodException * @throws ClassNotFoundException * @throws ConnectTimeoutException */ public NettyClientBase getClient(InetSocketAddress addr, Class<?> protocolClass, boolean asyncMode) throws NoSuchMethodException, ClassNotFoundException, ConnectTimeoutException { RpcConnectionKey key = new RpcConnectionKey(addr, protocolClass, asyncMode); NettyClientBase client; synchronized (clients) { client = clients.get(key); if (client == null) { clients.put(key, client = makeClient(key)); } } if (!client.isConnected()) { client.connect(); client.getChannel().closeFuture().addListener(new ConnectionCloseFutureListener(key)); } assert client.isConnected(); return client; }
client.connect(); assert client.isConnected(); return (T) client;
client.connect(); assert client.isConnected(); return (T) client;