void (final Runnable run) { class MyProcessAdapter extends ProcessAdapter { private boolean alreadyRun = false; public synchronized void run() { if (!alreadyRun) { alreadyRun = true; run.run(); } removeProcessListener(this); } @Override public void startNotified(@NotNull ProcessEvent event) { run(); } } MyProcessAdapter processListener = new MyProcessAdapter(); addProcessListener(processListener); if (myExecutionResult != null) { if (myExecutionResult.getProcessHandler().isStartNotified()) { processListener.run(); } } }