public void clear() { try { MThread.getWithTimeout(new ValueProvider<String>() { @Override public String getValue() throws Exception { synchronized (running) { if (running.isEmpty()) return ""; return null; } } }, 10000, false); } catch (TimeoutRuntimeException e) { log().i("Can't stop running jobs"); } jobs.clear(); queue.clear(); }