/** * @see ExclusiveSharedSynchronizer#clearOwnerId(Object) */ @Override protected final void clearOwnerId(Object context) { this.ownerId = null; this.sync.clearOwnerThread(); }
/** * Attempts to set the state to reflect a release in exclusive mode. * * <p> * This method is always invoked by the thread performing release. * * @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. */ private final void tryRelease() { if (compareAndSet(1, 0)) { this.sync.clearOwnerThread(); } else { // if system is going down then this can happen in some rare cases getCancelCriterion().checkCancelInProgress(null); throw new IllegalMonitorStateException("lock not held in release"); } }
/** * Attempts to set the state to reflect a release in exclusive mode. * * <p> * This method is always invoked by the thread performing release. * * @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. */ private final void tryRelease() { if (compareAndSet(WRITE_MASK, 0)) { this.sync.clearOwnerThread(); } else { // if system is going down then this can happen in some rare cases getCancelCriterion().checkCancelInProgress(null); throw new IllegalMonitorStateException("write lock not held in release"); } }
/** * 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(); } }
this.sync.clearOwnerThread(); if (compareAndSet(EXCLUSIVE_ONE, 0)) { return true; this.sync.clearOwnerThread();
this.sync.clearOwnerThread(); if (compareAndSet(EXCLUSIVE_ONE, 0)) { return true; this.sync.clearOwnerThread();
this.sync.clearOwnerThread(); if (compareAndSet(EXCLUSIVE_ONE, 0)) { return true; this.sync.clearOwnerThread();
/** * @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(); } } } }