@Override public void run() throws SQLException { while (list.size() > 0) { RunnableWithLazyProxyDirTreeDbProvider r = list.get(0); try { ((StackingNonPreemptiveThread) Thread.currentThread()).setTopPriority(); closingHook(); r.setProv(getProv()); if (isOpeningHookFinished) { isOpeningHookFinished = false; } else { r.openingHook(); } r.run(); nextRunnableForClosingHook = r; } catch (InterruptedException e) { } list.remove(0); } }