public void _run() { for (; ; ) { if (stop) return; synchronized (saver_thread_monitor) { D_DirectoryEntry de = need_saving_next(); if (de != null) { Application_GUI.ThreadsAccounting_ping("Saving"); need_saving_remove(de.globalIDhash, de.instance); // try 3 times to save for (int k = 0; k < 3; k++) { try { de.update(); break; } catch (P2PDDSQLException e) { e.printStackTrace(); synchronized (this) { try { wait(SAVER_SLEEP_ON_ERROR); } catch (InterruptedException e2) { e2.printStackTrace(); } } } } } else { Application_GUI.ThreadsAccounting_ping("Nothing to do!"); } } synchronized (this) { try { wait(SAVER_SLEEP); } catch (InterruptedException e) { e.printStackTrace(); } } } }