private void waitForInstanceToFinish() { OPMInstanceExecutor executor = null; while (true) { try { executor = getResultQueue().take(); executingInstances.remove(executor.getInstance()); break; } catch (InterruptedException e) { if (isStopped()) { return; } else { logger.finest( "Thread interrupted while waiting for result from queue. Will continue waiting."); } } } executor.finishExecution(); addExecutedProcess(executor.getProcess()); putProcessesInWaitingList(calculateFollowingProcesses(executor)); }