Source:
public ICommandResult executeCommand(final String command, final IProgressMonitor monitor, final boolean checkReturnValue) throws ExecutionException { if (fIsConnected) { FutureTask<CommandResult> future = new FutureTask<>(new Callable<CommandResult>() { @Override public CommandResult call() throws IOException, CancellationException { final ArrayList<String> result = new ArrayList<>(); final ArrayList<String> errorResult = new ArrayList<>(); synchronized (fHostShell) { fReturnValue = 0; int startAlias = fRandom.nextInt(); int endAlias = fRandom.nextInt(); fHostShell.writeToShell(formatShellCommand(command, startAlias, endAlias)); String nextLine; boolean isStartFound = false; while ((nextLine = fInputBufferReader.readLine()) != null) { if (monitor.isCanceled()) { flushInput(); throw new CancellationException(); } if (isAliasEchoResult(nextLine, startAlias, true)) { isStartFound = true; continue; } if (isAliasEchoResult(nextLine, endAlias, false)) { break; } if (!isStartFound || isCommandEcho(nextLine, command) || nextLine.contains(getEchoResult(endAlias))) { continue; } result.add(nextLine); } flushInput(); if (fReturnValue != 0) { while(fErrorBufferReader.ready()) { if ((nextLine = fErrorBufferReader.readLine()) != null) { errorResult.add(nextLine); } } if (errorResult.isEmpty()) { errorResult.addAll(result); } } } return new CommandResult(fReturnValue, result.toArray(new String[result.size()]), errorResult.toArray(new String[errorResult.size()])); } }); fExecutor.execute(future); try { return future.get(600, TimeUnit.SECONDS); } catch (java.util.concurrent.ExecutionException ex) { throw new ExecutionException(Messages.TraceControl_ExecutionFailure, ex); } catch (InterruptedException ex) { throw new ExecutionException(Messages.TraceControl_ExecutionCancelled, ex); } catch (TimeoutException ex) { throw new ExecutionException(Messages.TraceControl_ExecutionTimeout, ex); } } throw new ExecutionException(Messages.TraceControl_ShellNotConnected, null); }

Target:
public ICommandResult executeCommand(final String command, final IProgressMonitor monitor, final boolean checkReturnValue) throws ExecutionException { if (fIsConnected) { FutureTask<CommandResult> future = new FutureTask<>(new Callable<CommandResult>() { @Override public CommandResult call() throws IOException, CancellationException { final ArrayList<String> result = new ArrayList<>(); final ArrayList<String> errorResult = new ArrayList<>(); synchronized (fHostShell) { fReturnValue = 0; int startAlias = fRandom.nextInt(); int endAlias = fRandom.nextInt(); fHostShell.writeToShell(formatShellCommand(command, startAlias, endAlias)); String nextLine; boolean isStartFound = false; while ((nextLine = fInputBufferReader.readLine()) != null) { if (monitor.isCanceled()) { flushInput(); throw new CancellationException(); } if (isAliasEchoResult(nextLine, startAlias, true)) { isStartFound = true; continue; } if (isAliasEchoResult(nextLine, endAlias, false)) { break; } if (!isStartFound || isCommandEcho(nextLine, command) || nextLine.contains(getEchoResult(endAlias))) { continue; } result.add(nextLine); } flushInput(); if (fReturnValue != 0) { while(fErrorBufferReader.ready()) { if ((nextLine = fErrorBufferReader.readLine()) != null) { errorResult.add(nextLine); } } if (errorResult.isEmpty()) { errorResult.addAll(result); } } } return new CommandResult(fReturnValue, result.toArray(new String[result.size()]), errorResult.toArray(new String[errorResult.size()])); } }); fExecutor.execute(future); try { return future.get(ControlPreferences.getInstance().getCommandTimeout(), TimeUnit.SECONDS); } catch (java.util.concurrent.ExecutionException ex) { throw new ExecutionException(Messages.TraceControl_ExecutionFailure, ex); } catch (InterruptedException ex) { throw new ExecutionException(Messages.TraceControl_ExecutionCancelled, ex); } catch (TimeoutException ex) { throw new ExecutionException(Messages.TraceControl_ExecutionTimeout, ex); } } throw new ExecutionException(Messages.TraceControl_ShellNotConnected, null); }