@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 } }