private void obtainLock(Lock lock, String source) { try { if (!lock.tryLock(getLockTimeout(), TimeUnit.MILLISECONDS)) { dumpThreads(); throw new IllegalStateException("Could not obtain lock"); } } catch (InterruptedException e) { try { if (!lock.tryLock(getLockTimeout(), TimeUnit.MILLISECONDS)) { dumpThreads(); throw new IllegalStateException("Could not obtain lock"); } } catch (InterruptedException e1) { Thread.currentThread().interrupt(); // TODO is there a better exception to throw? throw new IllegalStateException("Interrupted twice: Could not obtain lock"); } Thread.currentThread().interrupt(); } }
private boolean doMissingWait() throws InterruptedException { if (!m_missingCondition.await(getLockTimeout(), TimeUnit.MILLISECONDS)) { log( LogService.LOG_ERROR, "waitForTracked timed out: {0} ceiling: {1} missing: {2}, Expect further errors", new Object[] {m_trackingCount, m_ceiling, m_missing}, null); dumpThreads(); m_missing.clear(); return false; } return true; }
@Override void reportTimeout() { dumpThreads(); }