/** * Called when events are delivered. * * @param events the events. */ public void onEvent(EventIterator events) { this.events = events; sync.release(); }
public void release() { readLock.release(); }
public void release() { readLock.release(); }
/** * This method is not thread-safe and calling threads must ensure that * only one thread calls this method at a time. */ private void notifyWaitingReaders() { Iterator<Sync> it = waitingReaders.iterator(); while (it.hasNext()) { it.next().release(); it.remove(); } }
/** * This method is not thread-safe and calling threads must ensure that * only one thread calls this method at a time. */ private void notifyWaitingReaders() { Iterator<Sync> it = waitingReaders.iterator(); while (it.hasNext()) { it.next().release(); it.remove(); } }
/** * This method may be called concurrently by multiple threads. */ private void notifyWaitingWriters() { synchronized (waitingWriters) { if (waitingWriters.isEmpty()) { return; } Iterator<Sync> it = waitingWriters.iterator(); while (it.hasNext()) { it.next().release(); it.remove(); } } }
/** * This method may be called concurrently by multiple threads. */ private void notifyWaitingWriters() { synchronized (waitingWriters) { if (waitingWriters.isEmpty()) { return; } Iterator<Sync> it = waitingWriters.iterator(); while (it.hasNext()) { it.next().release(); it.remove(); } } }
/** * When the calling thread returns this index merger will be idle, that is * there will be no merge tasks pending anymore. The method returns immediately * if there are currently no tasks pending at all. */ void waitUntilIdle() throws InterruptedException { mergerIdle.acquire(); // and immediately release again mergerIdle.release(); }
@Override public void run() { try { runTask(subscriber); } catch (Exception e) { log.error("Failed to deactivate content.", e); errors.add(e); } finally { sync.release(); } }
@Override public void run() { try { runTask(subscriber); } catch (Exception e) { log.error("Failed to deactivate content.", e); errors.add(e); } finally { sync.release(); } }
public void release() { readWriteLock.writeLock().release(); }
public void release() { readWriteLock.writeLock().release(); }
/** * Unlock the journal revision. * * @param successful flag indicating whether the update process was * successful */ public void unlock(boolean successful) { log.debug("Unlock the journal revision. Successful: " + successful); try { doUnlock(successful); } finally { //Should not happen that a RuntimeException will be thrown in subCode, but it's safer //to release the rwLock in finally block. rwLock.writeLock().release(); } }
/** * Unlock the journal revision. * * @param successful flag indicating whether the update process was * successful */ public void unlock(boolean successful) { log.debug("Unlock the journal revision. Successful: " + successful); try { doUnlock(successful); } finally { //Should not happen that a RuntimeException will be thrown in subCode, but it's safer //to release the rwLock in finally block. rwLock.writeLock().release(); } }
/** * Returns <code>true</code> if this workspace info is initialized, * otherwise returns <code>false</code>. * * @return <code>true</code> if this workspace info is initialized. */ protected final boolean isInitialized() { try { if (!initLock.readLock().attempt(0)) { return false; } } catch (InterruptedException e) { return false; } // can't use 'finally' pattern here boolean ret = initialized; initLock.readLock().release(); return ret; }
public int size() { Sync sync = this.lock.readLock(); try { sync.acquire(); try { return this.doGetSize(); } finally { sync.release(); } } catch (InterruptedException ignore) { return 0; } }
/** * Shuts down this repository. The shutdown is guarded by a shutdown lock * that prevents any new sessions from being started simultaneously. */ public void shutdown() { try { shutdownLock.writeLock().acquire(); } catch (InterruptedException e) { // TODO: Should this be a checked exception? throw new RuntimeException("Shutdown lock could not be acquired", e); } try { // check status of this instance if (!disposed) { doShutdown(); } } finally { shutdownLock.writeLock().release(); } }
/** * Returns <code>true</code> if this workspace info is initialized, * otherwise returns <code>false</code>. * * @return <code>true</code> if this workspace info is initialized. */ protected final boolean isInitialized() { try { if (!initLock.readLock().attempt(0)) { return false; } } catch (InterruptedException e) { return false; } // can't use 'finally' pattern here boolean ret = initialized; initLock.readLock().release(); return ret; }
private void internalSync(boolean startup) throws JournalException { try { rwLock.readLock().acquire(); } catch (InterruptedException e) { String msg = "Unable to acquire read lock."; throw new JournalException(msg, e); } try { doSync(getMinimalRevision(), startup); } finally { rwLock.readLock().release(); } }
private void internalSync(boolean startup) throws JournalException { try { rwLock.readLock().acquire(); } catch (InterruptedException e) { String msg = "Unable to acquire read lock."; throw new JournalException(msg, e); } try { doSync(getMinimalRevision(), startup); } finally { rwLock.readLock().release(); } }