Source:
public void execute(final String[] args) throws Exception { Opts opts = new Opts(); opts.parseArgs(Proxy.class.getName(), args); Properties proxyProps = opts.proxyProps; Properties clientProps = opts.clientProps; boolean useMini = Boolean .parseBoolean(proxyProps.getProperty(USE_MINI_ACCUMULO_KEY, USE_MINI_ACCUMULO_DEFAULT)); if (!proxyProps.containsKey("port")) { System.err.println("No port property"); System.exit(1); } if (useMini) { log.info("Creating mini cluster"); final File folder = Files.createTempDirectory(System.currentTimeMillis() + "").toFile(); final MiniAccumuloCluster accumulo = new MiniAccumuloCluster(folder, "secret"); accumulo.start(); clientProps = accumulo.getClientProperties(); Runtime.getRuntime().addShutdownHook(new Thread(() -> { try { accumulo.stop(); } catch (Exception e) { throw new RuntimeException(); } finally { if (!folder.delete()) log.warn("Unexpected error removing {}", folder); } })); } else if (clientProps == null) { System.err.println("The '-c' option must be set with an accumulo-client.properties file or" + " proxy.properties must contain either useMiniAccumulo=true"); System.exit(1); } Class<? extends TProtocolFactory> protoFactoryClass = Class .forName( proxyProps.getProperty("protocolFactory", TCompactProtocol.Factory.class.getName())) .asSubclass(TProtocolFactory.class); TProtocolFactory protoFactory = protoFactoryClass.newInstance(); int port = Integer.parseInt(proxyProps.getProperty("port")); String hostname = proxyProps.getProperty(THRIFT_SERVER_HOSTNAME, THRIFT_SERVER_HOSTNAME_DEFAULT); HostAndPort address = HostAndPort.fromParts(hostname, port); proxyProps.putAll(clientProps); ServerAddress server = createProxyServer(address, protoFactory, proxyProps); while (!server.server.isServing()) { Thread.sleep(100); } log.info("Proxy server started on {}", server.getAddress()); while (server.server.isServing()) { Thread.sleep(1000); } }

Target:
public void execute(final String[] args) throws Exception { Opts opts = new Opts(); opts.parseArgs(Proxy.class.getName(), args); Properties proxyProps = opts.proxyProps; Properties clientProps = opts.clientProps; boolean useMini = Boolean .parseBoolean(proxyProps.getProperty(USE_MINI_ACCUMULO_KEY, USE_MINI_ACCUMULO_DEFAULT)); if (!proxyProps.containsKey("port")) { System.err.println("No port property"); System.exit(1); } if (useMini) { log.info("Creating mini cluster"); final File folder = Files.createTempDirectory(System.currentTimeMillis() + "").toFile(); final MiniAccumuloCluster accumulo = new MiniAccumuloCluster(folder, "secret"); accumulo.start(); clientProps = accumulo.getClientProperties(); Runtime.getRuntime().addShutdownHook(new Thread(() -> { try { accumulo.stop(); } catch (InterruptedException|IOException e) { throw new RuntimeException(e); } finally { if (!folder.delete()) log.warn("Unexpected error removing {}", folder); } })); } else if (clientProps == null) { System.err.println("The '-c' option must be set with an accumulo-client.properties file or" + " proxy.properties must contain either useMiniAccumulo=true"); System.exit(1); } Class<? extends TProtocolFactory> protoFactoryClass = Class .forName( proxyProps.getProperty("protocolFactory", TCompactProtocol.Factory.class.getName())) .asSubclass(TProtocolFactory.class); TProtocolFactory protoFactory = protoFactoryClass.newInstance(); int port = Integer.parseInt(proxyProps.getProperty("port")); String hostname = proxyProps.getProperty(THRIFT_SERVER_HOSTNAME, THRIFT_SERVER_HOSTNAME_DEFAULT); HostAndPort address = HostAndPort.fromParts(hostname, port); proxyProps.putAll(clientProps); ServerAddress server = createProxyServer(address, protoFactory, proxyProps); while (!server.server.isServing()) { Thread.sleep(100); } log.info("Proxy server started on {}", server.getAddress()); while (server.server.isServing()) { Thread.sleep(1000); } }