public static void main(String args[]) { Config.setClientMode(true); LoaderOptions options = LoaderOptions.parseArgs(args); OutputHandler handler = new OutputHandler.SystemOutput(options.verbose, options.debug); SSTableLoader loader = new SSTableLoader( options.directory, new ExternalClient( options.hosts, options.rpcPort, options.user, options.passwd, options.transportFactory, options.storagePort, options.sslStoragePort, options.serverEncOptions), handler); DatabaseDescriptor.setStreamThroughputOutboundMegabitsPerSec(options.throttle); StreamResultFuture future = null; try { if (options.noProgress) future = loader.stream(options.ignores); else future = loader.stream(options.ignores, new ProgressIndicator()); } catch (Exception e) { System.err.println(e.getMessage()); if (e.getCause() != null) System.err.println(e.getCause()); if (options.debug) e.printStackTrace(System.err); else System.err.println("Run with --debug to get full stack trace or --help to get help."); System.exit(1); } handler.output(String.format("Streaming session ID: %s", future.planId)); try { future.get(); System.exit(0); // We need that to stop non daemonized threads } catch (Exception e) { System.err.println("Streaming to the following hosts failed:"); System.err.println(loader.getFailedHosts()); System.err.println(e); if (options.debug) e.printStackTrace(System.err); System.exit(1); } }