/** Notify the worker that new entry to delete appeared. */ void signal() { lock.lock(); try { force = true; cond.signalAll(); } finally { lock.unlock(); } }
/** {@inheritDoc} */ @Override protected void body() throws InterruptedException { if (log.isDebugEnabled()) log.debug("Delete worker started."); while (!cancelled) { lock.lock(); try { if (!cancelled && !force) cond.await(FREQUENCY, TimeUnit.MILLISECONDS); force = false; // Reset force flag. } finally { lock.unlock(); } if (!cancelled) delete(); } }