public void unlock() { Signaller s = endRead(); if (s != null) s.signalWaiters(); }
/** * Attempts to release this lock. * * <p> If the number of readers is now zero then the lock * is made available for write lock attempts. */ public void unlock() { switch (lock.sync.endRead()) { case Sync.NONE: return; case Sync.READER: lock.readerLock_.signalWaiters(); return; case Sync.WRITER: lock.writerLock_.signalWaiters(); return; } }
public void unlock(){ Signaller s = endWrite(); if (s != null) s.signalWaiters(); }
/** * Return the lock used for writing. */ @Override public Lock writeLock() { return sourceLock.writeLock(); } }
/** * Create a {@link ca.odell.glazedlists.util.concurrent.Lock}. * * <p>The default implementation returns an implementation that has been * derived from Doug Lea's <a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html">util.concurrent</a>. */ public Lock createLock() { return new J2SE14ReadWriteLock().writeLock(); } }
/** * Creates an empty {@link BasicEventList} with the given * <code>initialCapacity</code>. */ public BasicEventList(int initalCapacity) { this(initalCapacity, null, LockFactory.DEFAULT.createReadWriteLock()); }
@Override public Lock createLock() { return delegate.createLock(); } }
/** * Queries the number of reentrant read holds on this lock by the * current thread. A reader thread has a hold on a lock for * each lock action that is not matched by an unlock action. * * @return the number of holds on the read lock by the current thread, * or zero if the read lock is not held by the current thread * @since 1.6 */ public int getReadHoldCount() { return sync.getReadHoldCount(); }
protected synchronized boolean startWriteFromNewWriter() { boolean pass = startWrite(); if (!pass) ++waitingWriters_; return pass; }
/** * Queries if the write lock is held by any thread. This method is * designed for use in monitoring system state, not for * synchronization control. * * @return {@code true} if any thread holds the write lock and * {@code false} otherwise */ public boolean isWriteLocked() { return sync.isWriteLocked(); }
synchronized boolean startWriteFromWaitingWriter() { boolean pass = startWrite(); if (pass) --waitingWriters_; return pass; }
/** * Queries if this write lock is held by the current thread. * Identical in effect to {@link * java.util.concurrent.locks.ReentrantReadWriteLock#isWriteLockedByCurrentThread}. * * @return {@code true} if the current thread holds this lock and * {@code false} otherwise * @since 1.6 */ public boolean isHeldByCurrentThread() { return lock.sync.isWriteLockedByCurrentThread(); }
protected synchronized boolean startReadFromWaitingReader() { boolean pass = startRead(); if (pass) --waitingReaders_; return pass; }
/** * Attempts to release this lock. * * <p> If the number of readers is now zero then the lock * is made available for write lock attempts. */ public void unlock() { switch (lock.sync.endRead()) { case Sync.NONE: return; case Sync.READER: lock.readerLock_.signalWaiters(); return; case Sync.WRITER: lock.writerLock_.signalWaiters(); return; } }
public void unlock(){ Signaller s = endWrite(); if (s != null) s.signalWaiters(); }
/** * Create a {@link ca.odell.glazedlists.util.concurrent.Lock}. * * <p>The default implementation returns an implementation that has been * derived from Doug Lea's <a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html">util.concurrent</a>. */ public Lock createLock() { return new J2SE14ReadWriteLock().writeLock(); } }
/** * Creates a {@link BasicEventList}. */ public BasicEventList() { this(LockFactory.DEFAULT.createReadWriteLock()); }
/** * Queries the number of reentrant read holds on this lock by the * current thread. A reader thread has a hold on a lock for * each lock action that is not matched by an unlock action. * * @return the number of holds on the read lock by the current thread, * or zero if the read lock is not held by the current thread * @since 1.6 */ public int getReadHoldCount() { return sync.getReadHoldCount(); }
protected synchronized boolean startWriteFromWaitingWriter() { boolean pass = startWrite(); if (pass) --waitingWriters_; return pass; }
/** Recreate an appropriate lock implementation when deserialized on the target JVM. */ private Object readResolve() throws ObjectStreamException { return LockFactory.DEFAULT.createReadWriteLock(); } }