@Override public void close() { RpcClientManager.cleanup(client); } }
@Override public void close() { RpcClientManager.cleanup(client); } }
public void stopProgress() { if (isStopped) { return; } else { isStopped = true; } LOG.info("========================================================="); LOG.info("Stop query:" + queryId); masterContext.getResourceManager().getScheduler().stopQuery(queryId); RpcClientManager.cleanup(queryMasterRpc); try { masterContext.getHistoryWriter().appendAndFlush(queryInfo); } catch (Throwable e) { LOG.warn(e, e); } }
public void stopProgress() { if (isStopped) { return; } else { isStopped = true; } LOG.info("========================================================="); LOG.info("Stop query:" + queryId); masterContext.getResourceManager().getScheduler().stopQuery(queryId); RpcClientManager.cleanup(queryMasterRpc); try { masterContext.getHistoryWriter().appendAndFlush(queryInfo); } catch (Throwable e) { LOG.warn(e, e); } }
RpcClientManager.cleanup(queryMasterClient);
RpcClientManager.cleanup(queryMasterClient);
@Override public void close() { if (closed.getAndSet(true)) { return; } // remove session NettyClientBase client = null; try { client = getTajoMasterConnection(); BlockingInterface tajoMaster = client.getStub(); tajoMaster.removeSession(null, sessionId); } catch (Throwable e) { // ignore } finally { RpcClientManager.cleanup(client); NettyUtils.shutdown(eventLoopGroup); } }
@Override public void close() { if (closed.getAndSet(true)) { return; } // remove session NettyClientBase client = null; try { client = getTajoMasterConnection(); BlockingInterface tajoMaster = client.getStub(); tajoMaster.removeSession(null, sessionId); } catch (Throwable e) { // ignore } finally { RpcClientManager.cleanup(client); NettyUtils.shutdown(eventLoopGroup); } }
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; } }
/** * Run this instance against the server once. * @return an object of type T * @throws java.io.IOException if a remote or network exception occurs * @throws RuntimeException other unspecified error */ public T withoutRetries() throws IOException, RuntimeException { NettyClientBase client = null; try { beforeCall(); client = manager.getClient(addr, protocol, asyncMode); return call(client); } catch (Throwable t) { Throwable t2 = translateException(t); if (t2 instanceof IOException) { throw (IOException)t2; } else { throw new RuntimeException(t2); } } finally { afterCall(); if(closeConn) { RpcClientManager.cleanup(client); } } }
afterCall(); if(closeConn) { RpcClientManager.cleanup(client);
public synchronized NettyClientBase getTajoMasterConnection() { if (client != null && client.isConnected()) { return client; } else { try { RpcClientManager.cleanup(client); // Client do not closed on idle state for support high available this.client = manager.newBlockingClient(getTajoMasterAddr(), TajoMasterClientProtocol.class, eventLoopGroup, clientParams); } catch (Throwable t) { throw new TajoRuntimeException(new ClientConnectionException(t)); } return client; } }
public synchronized NettyClientBase getTajoMasterConnection() { if (client != null && client.isConnected()) { return client; } else { try { RpcClientManager.cleanup(client); // Client do not closed on idle state for support high available this.client = manager.newBlockingClient(getTajoMasterAddr(), TajoMasterClientProtocol.class, eventLoopGroup, clientParams); } catch (Throwable t) { throw new TajoRuntimeException(new ClientConnectionException(t)); } 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); } }