/** * Releases the lock previously acquired by a call to * {@link #attemptLock(long)}. Implemented by unblocking one or more threads. * * @throws IllegalMonitorStateException * if releasing would place this synchronizer in an illegal state. * This exception must be thrown in a consistent fashion for * synchronization to work correctly. */ public final void releaseLock() { tryRelease(); this.sync.signalWaiters(); }
/** * @see Lock#unlock() */ public final void unlock() { tryRelease(); this.sync.signalWaiters(); }
/** * Releases in exclusive mode. Implemented by unblocking one or more threads. * * @throws IllegalMonitorStateException * if releasing would place this synchronizer in an illegal state or * lock is not held by the calling thread. This exception must be * thrown in a consistent fashion for synchronization to work * correctly. */ public final void releaseWriteLock() { tryRelease(); this.sync.signalWaiters(); }
/** * @see ReadWriteLockObject#releaseWriteLock(Object) */ public void releaseWriteLock(final Object owner) { final boolean traceLock = traceLock(); if (traceLock) { final StringBuilder sb = new StringBuilder( "releaseWriteLock: releasing write lock with owner=").append(owner) .append(", for "); SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_LOCK, fillSB(sb) .toString()); } final boolean result = tryRelease(0 /* not used */, owner, null); if (result) { this.sync.signalWaiters(); } if (traceLock) { SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_LOCK, fillSB( new StringBuilder("releaseWriteLock: write lock release with owner=") .append(owner).append(result ? ", successful" : ", unsuccessful") .append(" for lock ")).toString()); } }
/** * @see ReadWriteLockObject#releaseWriteLock(Object) */ public void releaseWriteLock(final Object owner) { final boolean traceLock = traceLock(); if (traceLock) { final StringBuilder sb = new StringBuilder( "releaseWriteLock: releasing write lock with owner=").append(owner) .append(", for "); SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_LOCK, fillSB(sb) .toString()); } final boolean result = tryRelease(0 /* not used */, owner, null); if (result) { this.sync.signalWaiters(); } if (traceLock) { SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_LOCK, fillSB( new StringBuilder("releaseWriteLock: write lock release with owner=") .append(owner).append(result ? ", successful" : ", unsuccessful") .append(" for lock ")).toString()); } }
/** * @see ReadWriteLockObject#releaseWriteLock(Object) */ public void releaseWriteLock(final Object owner) { final boolean traceLock = traceLock(); if (traceLock) { final StringBuilder sb = new StringBuilder( "releaseWriteLock: releasing write lock with owner=").append(owner) .append(", for "); SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_LOCK, fillSB(sb) .toString()); } final boolean result = tryRelease(0 /* not used */, owner, null); if (result) { this.sync.signalWaiters(); } if (traceLock) { SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_LOCK, fillSB( new StringBuilder("releaseWriteLock: write lock release with owner=") .append(owner).append(result ? ", successful" : ", unsuccessful") .append(" for lock ")).toString()); } }
/** * Signal any waiting threads in the {@link QueuedSynchronizer}. By default * the {@link QueuedSynchronizer} is obtained by a call to * {@link #getQueuedSynchronizer}. */ protected void signalQueuedSynchronizer(final Object context, final boolean shared) { final QueuedSynchronizer sync = getQueuedSynchronizer(context); if (shared) { sync.signalSharedWaiters(); } else { sync.clearOwnerThread(); sync.signalWaiters(); } }
/** * @see ExclusiveSharedSynchronizer#signalQueuedSynchronizer(Object, boolean) */ @Override protected final void signalQueuedSynchronizer(final Object context, final boolean shared) { if (hasWaiters()) { // if there is waiting thread queue then need to empty that too final CustomEntryConcurrentHashMap<RegionEntry, QueuedSynchronizer> lockWaiters = ((LocalRegion)context).getLockWaiters(); final QueuedSynchronizer sync = lockWaiters.get(this); if (sync != null) { if (shared) { sync.signalSharedWaiters(); } else { sync.clearOwnerThread(); sync.signalWaiters(); } } } }