@VisibleForTesting static Future<Void> createSparkLauncherFuture(CountDownLatch shutdownLatch, SparkAppHandle sparkAppHandle, RpcServer rpcServer, String clientId) { // Monitor the countdown latch Callable<Void> runnable = () -> { try { shutdownLatch.await(); } catch (InterruptedException e) { rpcServer.cancelClient(clientId, "Spark app launcher interrupted"); sparkAppHandle.stop(); } return null; }; FutureTask<Void> futureTask = new FutureTask<>(runnable); Thread driverThread = new Thread(futureTask); driverThread.setDaemon(true); driverThread.setName("SparkLauncherMonitor"); driverThread.start(); return futureTask; }
public boolean stop() { try { appHandle.stop(); //streamingContext.stop(); //streamingContext.awaitTermination(); return true; } catch (Exception e) { e.printStackTrace(); return false; } }