public CrawlURI next() throws InterruptedException { CrawlURI crawlable = null; while(crawlable==null) { outboundLock.readLock().lockInterruptibly(); // try filling outbound until we get something to work on crawlable = findEligibleURI(); outboundLock.readLock().unlock(); } return crawlable; }
/** * Delegate the call to the internal {@link java.util.concurrent.locks.ReentrantReadWriteLock} instance * and then increment the read lock count held by the thread */ @Override public void lockInterruptibly() throws InterruptedException { delegate.readLock().lockInterruptibly(); incReadLockCount(); }
private void takeUpdateLock(String opDesc) throws IndexBuildingFailureException { boolean interrupted = false; // lock the log, so we are sure that index write gets atomically committed LOG.debug("Taking INDEX_UPDATE readlock for " + opDesc); // wait for the update lock while (!this.stopped) { try { INDEX_UPDATE_LOCK.lockInterruptibly(); LOG.debug("Got the INDEX_UPDATE readlock for " + opDesc); // unlock the lock so the server can shutdown, if we find that we have stopped since getting // the lock if (this.stopped) { INDEX_UPDATE_LOCK.unlock(); throw new IndexBuildingFailureException( "Found server stop after obtaining the update lock, killing update attempt"); } break; } catch (InterruptedException e) { LOG.info("Interrupted while waiting for update lock. Ignoring unless stopped"); interrupted = true; } } if (interrupted) { Thread.currentThread().interrupt(); } }
@Override public void lockInterruptibly() throws InterruptedException { aboutToAcquire(readWriteLock); try { super.lockInterruptibly(); } finally { lockStateChanged(readWriteLock); } }
@Override public void lockInterruptibly() throws InterruptedException { aboutToAcquire(readWriteLock); try { super.lockInterruptibly(); } finally { lockStateChanged(readWriteLock); } }
@Override public void lockInterruptibly() throws InterruptedException { aboutToAcquire(readWriteLock); try { super.lockInterruptibly(); } finally { lockStateChanged(readWriteLock); } }
@Override public void lockInterruptibly() throws InterruptedException { aboutToAcquire(readWriteLock); try { super.lockInterruptibly(); } finally { lockStateChanged(readWriteLock); } }
@Override public void lockInterruptibly() throws InterruptedException { aboutToAcquire(readWriteLock); try { super.lockInterruptibly(); } finally { lockStateChanged(readWriteLock); } }
@Override public void lockInterruptibly() throws InterruptedException { aboutToAcquire(readWriteLock); try { super.lockInterruptibly(); } finally { lockStateChanged(readWriteLock); } }
@Override public void lockInterruptibly() throws InterruptedException { aboutToAcquire(readWriteLock); try { super.lockInterruptibly(); } finally { lockStateChanged(readWriteLock); } }
@Override public void lockInterruptibly() throws InterruptedException { aboutToAcquire(readWriteLock); try { super.lockInterruptibly(); } finally { lockStateChanged(readWriteLock); } }
/** * Delegate the call to the internal {@link java.util.concurrent.locks.ReentrantReadWriteLock} instance * and then increment the read lock count held by the thread */ @Override public void lockInterruptibly() throws InterruptedException { delegate.readLock().lockInterruptibly(); incReadLockCount(); }
@Override public void lockInterruptibly() throws InterruptedException { aboutToAcquire(readWriteLock); try { super.lockInterruptibly(); } finally { lockStateChanged(readWriteLock); } }
@Override public void lockInterruptibly() throws InterruptedException { trySpin(); super.lockInterruptibly(); forceSpin = false; }
@Override public void lockInterruptibly() throws InterruptedException { forceSpin = true; super.lockInterruptibly(); }
public void readLockInterruptibly() throws InterruptedException { coarseLock.readLock().lockInterruptibly(); if (coarseLock.getReadHoldCount() == 1) { readLockHeldTimeStampNanos.set(timer.monotonicNowNanos()); } }
@Override public void lockInterruptibly() throws InterruptedException { aboutToAcquire(readWriteLock); try { super.lockInterruptibly(); } finally { lockStateChanged(readWriteLock); } }
@Override public void lockInterruptibly() throws InterruptedException { aboutToAcquire(readWriteLock); try { super.lockInterruptibly(); } finally { lockStateChanged(readWriteLock); } }
@Override public void lockInterruptibly() throws InterruptedException { aboutToAcquire(readWriteLock); try { super.lockInterruptibly(); } finally { lockStateChanged(readWriteLock); } }
@Override public void lockInterruptibly() throws InterruptedException { aboutToAcquire(readWriteLock); try { super.lockInterruptibly(); } finally { lockStateChanged(readWriteLock); } }