@Override public void run() { try { Thread.sleep(1000); // next waitFor() can finish too quickly on Linux! commandRunner.waitForCommandToFinish(); synchronized (fitClient) { if (!fitClient.isConnectionEstablished()) { fitClient.notify(); Exception e = new Exception( "FitClient: external process terminated before a connection could be established."); commandRunner.exceptionOccurred(e); fitClient.exceptionOccurred(e); } } } catch (InterruptedException e) { Thread.currentThread().interrupt(); // remember interrupted } }
@Override public void start(CommandRunningFitClient fitClient, int port, int ticketNumber) throws IOException { makeCommandRunner(port, ticketNumber); commandRunner.asynchronousStart(); timeoutThread = new Thread(new TimeoutRunnable(fitClient), "FitClient timeout"); timeoutThread.start(); earlyTerminationThread = new Thread( new EarlyTerminationRunnable(fitClient, commandRunner), "FitClient early termination"); earlyTerminationThread.start(); }
@Override public void kill() { commandRunner.kill(); killVigilantThreads(); }
@Override public void join() { commandRunner.join(); killVigilantThreads(); }