/** * Create a Thrift client using the given factory with a pooled transport (if available), the * address, and client context with no timeout. * * @param factory * Thrift client factory * @param address * Server address for client to connect to * @param context * RPC options */ public static <T extends TServiceClient> T getClientNoTimeout(TServiceClientFactory<T> factory, HostAndPort address, ClientContext context) throws TTransportException { return getClient(factory, address, context, 0); }
/** * Create a TabletServer Thrift client * * @param address * Server address for client to connect to * @param context * RPC options */ public static TabletClientService.Client getTServerClient(HostAndPort address, ClientContext context) throws TTransportException { return getClient(new TabletClientService.Client.Factory(), address, context); }
private MasterClientService.Client masterConnection(HostAndPort address) { try { if (address == null) { return null; } // log.info("Listener API to master has been opened"); return ThriftUtil.getClient(new MasterClientService.Client.Factory(), address, context); } catch (Exception e) { log.warn("Issue with masterConnection (" + address + ") " + e, e); } return null; }
/** * Create a TabletServer Thrift client * * @param address * Server address for client to connect to * @param context * Options for connecting to the server * @param timeout * Socket timeout which overrides the ClientContext timeout */ public static TabletClientService.Client getTServerClient(HostAndPort address, ClientContext context, long timeout) throws TTransportException { return getClient(new TabletClientService.Client.Factory(), address, context, timeout); }
/** * Attempt a single time to create a ReplicationServicer client to the given host * * @param context * The client session for the peer replicant * @param server * Server to connect to * @param timeout * RPC timeout in milliseconds * @return A ReplicationServicer client to the given host in the given instance */ public static ReplicationServicer.Client getServicerConnection(ClientContext context, HostAndPort server, long timeout) throws TTransportException { requireNonNull(context); requireNonNull(server); try { return ThriftUtil.getClient(new ReplicationServicer.Client.Factory(), server, context, timeout); } catch (TTransportException tte) { log.debug("Failed to connect to servicer ({}), will retry...", server, tte); throw tte; } }
public void splitTablet(KeyExtent extent, Text splitPoint) throws TException, ThriftSecurityException, NotServingTabletException { TabletClientService.Client client = ThriftUtil .getClient(new TabletClientService.Client.Factory(), address, context); try { client.splitTablet(Tracer.traceInfo(), context.rpcCreds(), extent.toThrift(), ByteBuffer.wrap(splitPoint.getBytes(), 0, splitPoint.getLength())); } finally { ThriftUtil.returnClient(client); } }
public void compact(ZooLock lock, String tableId, byte[] startRow, byte[] endRow) throws TException { TabletClientService.Client client = ThriftUtil .getClient(new TabletClientService.Client.Factory(), address, context); try { client.compact(Tracer.traceInfo(), context.rpcCreds(), lockString(lock), tableId, startRow == null ? null : ByteBuffer.wrap(startRow), endRow == null ? null : ByteBuffer.wrap(endRow)); } finally { ThriftUtil.returnClient(client); } }
public void flush(ZooLock lock, Table.ID tableId, byte[] startRow, byte[] endRow) throws TException { TabletClientService.Client client = ThriftUtil .getClient(new TabletClientService.Client.Factory(), address, context); try { client.flush(Tracer.traceInfo(), context.rpcCreds(), lockString(lock), tableId.canonicalID(), startRow == null ? null : ByteBuffer.wrap(startRow), endRow == null ? null : ByteBuffer.wrap(endRow)); } finally { ThriftUtil.returnClient(client); } }
public boolean isActive(long tid) throws TException { TabletClientService.Client client = ThriftUtil .getClient(new TabletClientService.Client.Factory(), address, context); try { return client.isActive(Tracer.traceInfo(), tid); } finally { ThriftUtil.returnClient(client); } }
private static GCStatus fetchGcStatus() { GCStatus result = null; HostAndPort address = null; try { // Read the gc location from its lock ZooReaderWriter zk = context.getZooReaderWriter(); String path = context.getZooKeeperRoot() + Constants.ZGC_LOCK; List<String> locks = zk.getChildren(path, null); if (locks != null && locks.size() > 0) { Collections.sort(locks); address = new ServerServices(new String(zk.getData(path + "/" + locks.get(0), null), UTF_8)) .getAddress(Service.GC_CLIENT); GCMonitorService.Client client = ThriftUtil.getClient(new GCMonitorService.Client.Factory(), address, context); try { result = client.getStatus(Tracer.traceInfo(), getContext().rpcCreds()); } finally { ThriftUtil.returnClient(client); } } } catch (Exception ex) { log.warn("Unable to contact the garbage collector at " + address, ex); } return result; }
public void fastHalt(ZooLock lock) throws TException { TabletClientService.Client client = ThriftUtil .getClient(new TabletClientService.Client.Factory(), address, context); try { client.fastHalt(Tracer.traceInfo(), context.rpcCreds(), lockString(lock)); } finally { ThriftUtil.returnClient(client); } }
public void halt(ZooLock lock) throws TException, ThriftSecurityException { TabletClientService.Client client = ThriftUtil .getClient(new TabletClientService.Client.Factory(), address, context); try { client.halt(Tracer.traceInfo(), context.rpcCreds(), lockString(lock)); } finally { ThriftUtil.returnClient(client); } }
/** * Fetch the tablets for the given table by asking the tablet server. Useful if your balance * strategy needs details at the tablet level to decide what tablets to move. * * @param tserver * The tablet server to ask. * @param tableId * The table id * @return a list of tablet statistics * @throws ThriftSecurityException * tablet server disapproves of your internal System password. * @throws TException * any other problem */ public List<TabletStats> getOnlineTabletsForTable(TServerInstance tserver, Table.ID tableId) throws ThriftSecurityException, TException { log.debug("Scanning tablet server {} for table {}", tserver, tableId); Client client = ThriftUtil.getClient(new TabletClientService.Client.Factory(), tserver.getLocation(), context); try { return client.getTabletStats(Tracer.traceInfo(), context.rpcCreds(), tableId.canonicalID()); } catch (TTransportException e) { log.error("Unable to connect to {}: ", tserver, e); } finally { ThriftUtil.returnClient(client); } return null; }
public void unloadTablet(ZooLock lock, KeyExtent extent, TUnloadTabletGoal goal, long requestTime) throws TException { TabletClientService.Client client = ThriftUtil .getClient(new TabletClientService.Client.Factory(), address, context); try { client.unloadTablet(Tracer.traceInfo(), context.rpcCreds(), lockString(lock), extent.toThrift(), goal, requestTime); } finally { ThriftUtil.returnClient(client); } }
public void chop(ZooLock lock, KeyExtent extent) throws TException { TabletClientService.Client client = ThriftUtil .getClient(new TabletClientService.Client.Factory(), address, context); try { client.chop(Tracer.traceInfo(), context.rpcCreds(), lockString(lock), extent.toThrift()); } finally { ThriftUtil.returnClient(client); } }
public void assignTablet(ZooLock lock, KeyExtent extent) throws TException { if (extent.isMeta()) { // see ACCUMULO-3597 try (TTransport transport = ThriftUtil.createTransport(address, context)) { TabletClientService.Client client = ThriftUtil .createClient(new TabletClientService.Client.Factory(), transport); loadTablet(client, lock, extent); } } else { TabletClientService.Client client = ThriftUtil .getClient(new TabletClientService.Client.Factory(), address, context); try { loadTablet(client, lock, extent); } finally { ThriftUtil.returnClient(client); } } }
ClientContext context = Monitor.getContext(); TabletClientService.Client client = ThriftUtil .getClient(new TabletClientService.Client.Factory(), address, context); try { for (String tableId : Monitor.getMmi().tableMap.keySet()) {
/** * Create a TabletServer Thrift client * * @param address * Server address for client to connect to * @param context * RPC options */ public static TabletClientService.Client getTServerClient(HostAndPort address, ClientContext context) throws TTransportException { return getClient(new TabletClientService.Client.Factory(), address, context); }
public void splitTablet(ZooLock lock, KeyExtent extent, Text splitPoint) throws TException, ThriftSecurityException, NotServingTabletException { TabletClientService.Client client = ThriftUtil .getClient(new TabletClientService.Client.Factory(), address, context); try { client.splitTablet(Tracer.traceInfo(), context.rpcCreds(), extent.toThrift(), ByteBuffer.wrap(splitPoint.getBytes(), 0, splitPoint.getLength())); } finally { ThriftUtil.returnClient(client); } }
public void unloadTablet(ZooLock lock, KeyExtent extent, TUnloadTabletGoal goal, long requestTime) throws TException { TabletClientService.Client client = ThriftUtil .getClient(new TabletClientService.Client.Factory(), address, context); try { client.unloadTablet(Tracer.traceInfo(), context.rpcCreds(), lockString(lock), extent.toThrift(), goal, requestTime); } finally { ThriftUtil.returnClient(client); } }