@Override public List<String> getMasterLocations() { return context.getMasterLocations(); }
public static MasterClientService.Client getConnection(ClientContext context) { checkArgument(context != null, "context is null"); List<String> locations = context.getMasterLocations(); if (locations.size() == 0) { log.debug("No masters..."); return null; } HostAndPort master = HostAndPort.fromString(locations.get(0)); if (master.getPort() == 0) return null; try { // Master requests can take a long time: don't ever time out return ThriftUtil.getClientNoTimeout(new MasterClientService.Client.Factory(), master, context); } catch (TTransportException tte) { Throwable cause = tte.getCause(); if (cause != null && cause instanceof UnknownHostException) { // do not expect to recover from this throw new RuntimeException(tte); } log.debug("Failed to connect to master=" + master + ", will retry... ", tte); return null; } }
public static ReplicationCoordinator.Client getCoordinatorConnection(ClientContext context) { List<String> locations = context.getMasterLocations();
private static void stopTabletServer(final ClientContext context, List<String> servers, final boolean force) throws AccumuloException, AccumuloSecurityException { if (context.getMasterLocations().size() == 0) { log.info("No masters running. Not attempting safe unload of tserver."); return; } final String zTServerRoot = getTServersZkPath(context); final ZooCache zc = context.getZooCache(); for (String server : servers) { for (int port : context.getConfiguration().getPort(Property.TSERV_CLIENTPORT)) { HostAndPort address = AddressUtil.parseAddress(server, port); final String finalServer = qualifyWithZooKeeperSessionId(zTServerRoot, zc, address.toString()); log.info("Stopping server {}", finalServer); MasterClient.executeVoid(context, client -> client.shutdownTabletServer(Tracer.traceInfo(), context.rpcCreds(), finalServer, force)); } } }