void () { while (true) { Pair<DebugProcessImpl, DebuggerCommandImpl> pair; synchronized (myCommands) { if (myCommands.isEmpty()) { break; } pair = myCommands.remove(0); } pair.getFirst().getManagerThread().invokeAndWait(pair.getSecond()); } }