/** NOTE: Not expected to call directly by regular users of this class. */ public synchronized void run() { final long end = System.currentTimeMillis() + timeout; long now; while (watch && (end > (now = System.currentTimeMillis()))) { try { wait(end - now); } catch (InterruptedException ignored) { // Not expected to be thrown } } if (watch) { try { cancellable.cancel(); } catch (Exception e) { LOG.error(e.getMessage(), e); } watch = false; } } }