@Override public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception { List<String> tservers; MasterMonitorInfo stats; MasterClientService.Iface client = null; ClientContext context = shellState.getContext(); while (true) { try { client = MasterClient.getConnectionWithRetry(context); stats = client.getMasterStats(Tracer.traceInfo(), context.rpcCreds()); break; } catch (ThriftNotActiveServiceException e) { // Let it loop, fetching a new location sleepUninterruptibly(100, TimeUnit.MILLISECONDS); } finally { if (client != null) MasterClient.close(client); } } final boolean paginate = !cl.hasOption(disablePaginationOpt.getOpt()); if (cl.hasOption(tserverOption.getOpt())) { tservers = new ArrayList<>(); tservers.add(cl.getOptionValue(tserverOption.getOpt())); } else { tservers = Collections.emptyList(); } shellState.printLines(new BulkImportListIterator(tservers, stats), paginate); return 0; }
private long beginFateOperation() throws ThriftSecurityException, TException { while (true) { MasterClientService.Iface client = null; try { client = MasterClient.getConnectionWithRetry(context); return client.beginFateOperation(Tracer.traceInfo(), context.rpcCreds()); } catch (TTransportException tte) { log.debug("Failed to call beginFateOperation(), retrying ... ", tte); sleepUninterruptibly(100, TimeUnit.MILLISECONDS); } catch (ThriftNotActiveServiceException e) { // Let it loop, fetching a new location log.debug("Contacted a Master which is no longer active, retrying"); sleepUninterruptibly(100, TimeUnit.MILLISECONDS); } finally { MasterClient.close(client); } } }
private String waitForFateOperation(long opid) throws ThriftSecurityException, TException, ThriftTableOperationException { while (true) { MasterClientService.Iface client = null; try { client = MasterClient.getConnectionWithRetry(context); return client.waitForFateOperation(Tracer.traceInfo(), context.rpcCreds(), opid); } catch (TTransportException tte) { log.debug("Failed to call waitForFateOperation(), retrying ... ", tte); sleepUninterruptibly(100, TimeUnit.MILLISECONDS); } catch (ThriftNotActiveServiceException e) { // Let it loop, fetching a new location log.debug("Contacted a Master which is no longer active, retrying"); sleepUninterruptibly(100, TimeUnit.MILLISECONDS); } finally { MasterClient.close(client); } } }
private void finishFateOperation(long opid) throws ThriftSecurityException, TException { while (true) { MasterClientService.Iface client = null; try { client = MasterClient.getConnectionWithRetry(context); client.finishFateOperation(Tracer.traceInfo(), context.rpcCreds(), opid); break; } catch (TTransportException tte) { log.debug("Failed to call finishFateOperation(), retrying ... ", tte); sleepUninterruptibly(100, TimeUnit.MILLISECONDS); } catch (ThriftNotActiveServiceException e) { // Let it loop, fetching a new location log.debug("Contacted a Master which is no longer active, retrying"); sleepUninterruptibly(100, TimeUnit.MILLISECONDS); } finally { MasterClient.close(client); } } }
private void executeFateOperation(long opid, FateOperation op, List<ByteBuffer> args, Map<String,String> opts, boolean autoCleanUp) throws ThriftSecurityException, TException, ThriftTableOperationException { while (true) { MasterClientService.Iface client = null; try { client = MasterClient.getConnectionWithRetry(context); client.executeFateOperation(Tracer.traceInfo(), context.rpcCreds(), opid, op, args, opts, autoCleanUp); return; } catch (TTransportException tte) { log.debug("Failed to call executeFateOperation(), retrying ... ", tte); sleepUninterruptibly(100, TimeUnit.MILLISECONDS); } catch (ThriftNotActiveServiceException e) { // Let it loop, fetching a new location log.debug("Contacted a Master which is no longer active, retrying"); sleepUninterruptibly(100, TimeUnit.MILLISECONDS); } finally { MasterClient.close(client); } } }
} finally { if (client != null) close(client);
} finally { if (client != null) close(client);
} finally { if (client != null) { MasterClient.close(client);