/** * Connect a {@link NettyClientBase} to the remote {@link NettyServerBase}, and returns rpc client by protocol. * This client does not managed. It should close. */ public <T extends NettyClientBase> T newClient(InetSocketAddress addr, Class<?> protocolClass, boolean asyncMode, Properties rpcParams) throws NoSuchMethodException, ClassNotFoundException, ConnectException { return newClient(new RpcConnectionKey(addr, protocolClass, asyncMode), rpcParams); }
/** * Connect a {@link NettyClientBase} to the remote {@link NettyServerBase}, and returns rpc client by protocol. * This client does not managed. It should close. */ public <T extends NettyClientBase> T newClient(InetSocketAddress addr, Class<?> protocolClass, boolean asyncMode, Properties rpcParams) throws NoSuchMethodException, ClassNotFoundException, ConnectException { return newClient(new RpcConnectionKey(addr, protocolClass, asyncMode), rpcParams); }
protected TajoResourceTrackerProtocol.TajoResourceTrackerProtocolService.Interface newStub() throws NoSuchMethodException, ConnectException, ClassNotFoundException { RpcClientManager.cleanup(rmClient); RpcClientManager rpcManager = RpcClientManager.getInstance(); rmClient = rpcManager.newClient(serviceTracker.getResourceTrackerAddress(), TajoResourceTrackerProtocol.class, true, rpcParams); return rmClient.getStub(); }
protected TajoResourceTrackerProtocol.TajoResourceTrackerProtocolService.Interface newStub() throws NoSuchMethodException, ConnectException, ClassNotFoundException { RpcClientManager.cleanup(rmClient); RpcClientManager rpcManager = RpcClientManager.getInstance(); rmClient = rpcManager.newClient(serviceTracker.getResourceTrackerAddress(), TajoResourceTrackerProtocol.class, true, rpcParams); return rmClient.getStub(); }
private void connectQueryMaster(WorkerConnectionInfo connectionInfo) throws NoSuchMethodException, ConnectException, ClassNotFoundException { RpcClientManager.cleanup(queryMasterRpc); InetSocketAddress addr = NetUtils.createSocketAddr(connectionInfo.getHost(), connectionInfo.getQueryMasterPort()); LOG.info("Try to connect to QueryMaster:" + addr); queryMasterRpc = RpcClientManager.getInstance().newClient(addr, QueryMasterProtocol.class, true, rpcParams); queryMasterRpcClient = queryMasterRpc.getStub(); }
private void connectQueryMaster(WorkerConnectionInfo connectionInfo) throws NoSuchMethodException, ConnectException, ClassNotFoundException { RpcClientManager.cleanup(queryMasterRpc); InetSocketAddress addr = NetUtils.createSocketAddr(connectionInfo.getHost(), connectionInfo.getQueryMasterPort()); LOG.info("Try to connect to QueryMaster:" + addr); queryMasterRpc = RpcClientManager.getInstance().newClient(addr, QueryMasterProtocol.class, true, rpcParams); queryMasterRpcClient = queryMasterRpc.getStub(); }
public synchronized NettyClientBase getCatalogConnection() throws ServiceException { if (client != null && client.isConnected()) return client; else { try { if (client != null && client.isConnected()) return client; RpcClientManager.cleanup(client); final Properties clientParams = new Properties(); clientParams.setProperty(RpcConstants.CLIENT_RETRY_NUM, conf.getVar(ConfVars.RPC_CLIENT_RETRY_NUM)); // Client do not closed on idle state for support high available this.client = RpcClientManager.getInstance().newClient(getCatalogServerAddr(), CatalogProtocol.class, false, clientParams); } catch (Exception e) { throw new ServiceException(e); } return client; } }
public synchronized NettyClientBase getCatalogConnection() throws ServiceException { if (client != null && client.isConnected()) return client; else { try { if (client != null && client.isConnected()) return client; RpcClientManager.cleanup(client); final Properties clientParams = new Properties(); clientParams.setProperty(RpcConstants.CLIENT_RETRY_NUM, conf.getVar(ConfVars.RPC_CLIENT_RETRY_NUM)); // Client do not closed on idle state for support high available this.client = RpcClientManager.getInstance().newClient(getCatalogServerAddr(), CatalogProtocol.class, false, clientParams); } catch (Exception e) { throw new ServiceException(e); } return client; } }
protected ExecutionBlockContext createExecutionBlock(ExecutionBlockId executionBlockId, String queryMasterHostAndPort) { LOG.info("QueryMaster Address:" + queryMasterHostAndPort); AsyncRpcClient client = null; try { InetSocketAddress address = NetUtils.createSocketAddr(queryMasterHostAndPort); ExecutionBlockContextRequest.Builder request = ExecutionBlockContextRequest.newBuilder(); request.setExecutionBlockId(executionBlockId.getProto()) .setWorker(getWorkerContext().getConnectionInfo().getProto()); client = RpcClientManager.getInstance().newClient(address, QueryMasterProtocol.class, true, rpcParams); QueryMasterProtocol.QueryMasterProtocolService.Interface stub = client.getStub(); CallFuture<ExecutionBlockContextResponse> callback = new CallFuture<ExecutionBlockContextResponse>(); stub.getExecutionBlockContext(callback.getController(), request.build(), callback); ExecutionBlockContextResponse contextProto = callback.get(); ExecutionBlockContext context = new ExecutionBlockContext(getWorkerContext(), contextProto, client); context.init(); return context; } catch (Throwable e) { RpcClientManager.cleanup(client); LOG.fatal(e.getMessage(), e); throw new RuntimeException(e); } }
protected ExecutionBlockContext createExecutionBlock(ExecutionBlockId executionBlockId, String queryMasterHostAndPort) { LOG.info("QueryMaster Address:" + queryMasterHostAndPort); AsyncRpcClient client = null; try { InetSocketAddress address = NetUtils.createSocketAddr(queryMasterHostAndPort); ExecutionBlockContextRequest.Builder request = ExecutionBlockContextRequest.newBuilder(); request.setExecutionBlockId(executionBlockId.getProto()) .setWorker(getWorkerContext().getConnectionInfo().getProto()); client = RpcClientManager.getInstance().newClient(address, QueryMasterProtocol.class, true, rpcParams); QueryMasterProtocol.QueryMasterProtocolService.Interface stub = client.getStub(); CallFuture<ExecutionBlockContextResponse> callback = new CallFuture<>(); stub.getExecutionBlockContext(callback.getController(), request.build(), callback); ExecutionBlockContextResponse contextProto = callback.get(); ExecutionBlockContext context = new ExecutionBlockContext(getWorkerContext(), contextProto, client, pullServerService); context.init(); return context; } catch (Throwable e) { RpcClientManager.cleanup(client); LOG.fatal(e.getMessage(), e); throw new RuntimeException(e); } }
qmClient = manager.newClient(qmAddress, QueryMasterClientProtocol.class, false, new Properties());
qmClient = manager.newClient(qmAddress, QueryMasterClientProtocol.class, false, new Properties());