public void acquireReadLock() throws InterruptedException { this.lock.attemptReadLock(-1, null); }
/** * Clear the cache retrieved value for given table. */ public void clearRetrievedValue(Object table) { this.generatedValuesLock.attemptWriteLock(-1); try { this.generatedValues.remove(table); } finally { this.generatedValuesLock.releaseWriteLock(); } }
public void releaseReadLock() { this.lock.releaseReadLock(); }
this.generatedValuesLock.attemptReadLock(-1); try { Object[] id = this.generatedValues.get(table); this.generatedValuesLock.releaseReadLock();
this.pendingTXRegionStatesLock.attemptWriteLock(-1); this.pendingTXRegionStatesLockOwner = Thread.currentThread(); this.pendingTXRegionStatesLock.attemptReadLock(-1); if (forWrite) { this.pendingTXRegionStatesLockOwner = null; this.pendingTXRegionStatesLock.releaseWriteLock(); this.pendingTXRegionStatesLock.releaseReadLock();
/** * {@inheritDoc} */ @Override public void unlockPendingTXRegionStates(final boolean forWrite) { if (this.pendingTXRegionStatesLock != null) { if (forWrite) { this.pendingTXRegionStatesLockOwner = null; this.pendingTXRegionStatesLock.releaseWriteLock(); } else { this.pendingTXRegionStatesLock.releaseReadLock(); } if (TXStateProxy.LOG_FINE) { final LogWriterI18n logger = InternalDistributedSystem.getLoggerI18n(); if (logger != null) { logger.info(LocalizedStrings.DEBUG, "ImageState#" + "unlockPendingTXRegionStates: " + (forWrite ? "write" : "read") + " lock released " + this.pendingTXRegionStatesLock); } } } }
/** * 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(Object owner) { releaseWriteLock(); }
public void acquireWriteLock() throws InterruptedException { this.lock.attemptWriteLock(-1, null); }
if (tryAcquireShared()) { return true; msecs = getMaxMillis(); final int waitThreshold = getWaitThreshold(); long timeoutMillis; LogWriterI18n logger = null; logger = NonReentrantLock.getDistributedSystem(true).getLogWriterI18n(); getCancelCriterion().checkCancelInProgress(null); msecs -= timeoutMillis; if (logger.warningEnabled()) { "NonReetrantReadWriteLock", Double.toString( (double)timeoutMillis / 1000.0), "READ", "this object", toString(), msecs });
if (tryAcquire()) { return true; msecs = getMaxMillis(); final int waitThreshold = getWaitThreshold(); long timeoutMillis; LogWriterI18n logger = null; logger = NonReentrantLock.getDistributedSystem(true).getLogWriterI18n(); getCancelCriterion().checkCancelInProgress(null); msecs -= timeoutMillis; if (logger.warningEnabled()) { "NonReentrantReadWriteLock", Double.toString( (double)timeoutMillis / 1000.0), "WRITE", "this object", toString(), msecs });
@Override public String toString() { return this.lock.toString(); } }
Segment(final int initialCapacity, final float lf, final HashEntryCreator<K, V> entryCreator) { this.loadFactor = lf; this.entryCreator = entryCreator; this.listUpdateLock = new NonReentrantReadWriteLock(); setTable(Segment.<K, V> newEntryArray(initialCapacity)); }
this.generatedValuesLock.attemptReadLock(-1); try { Object[] id = this.generatedValues.get(table); this.generatedValuesLock.releaseReadLock();
public void releaseWriteLock() { this.lock.releaseWriteLock(null); }
/** * An attempt to acquire write lock should succeed when there are no read * locks already taken ({@link #attemptReadLock(long)}). The owner argument is * ignored since this is a non-reentrant lock and the behaviour is identical * to {@link #attemptWriteLock(long)}. * * @param msecs * The timeout to wait for lock acquisition before failing. A value * equal to zero means not to wait at all, while a value less than * zero means to wait indefinitely. * * @return true if lock acquired successfully, false if the attempt timed out */ public final boolean attemptWriteLock(long msecs, Object owner) { return attemptWriteLock(msecs); }
TXFinishedMap(InternalDistributedSystem sys, CancelCriterion cancel) { this.mapLock = new NonReentrantReadWriteLock(sys, cancel); this.finishedMap = new CustomEntryConcurrentHashMap<Object, TXFinished>( 128, 0.75f, TXMAP_CONCURRENCY, false, new TXFinishedCreator()); this.tail = new TXFinished(0, 0, false, 0); this.tail.next = this.tail; }
/** * Clear the cache retrieved value for given table. */ public void clearRetrievedValue(Object table) { this.generatedValuesLock.attemptWriteLock(-1); try { this.generatedValues.remove(table); } finally { this.generatedValuesLock.releaseWriteLock(); } }
this.generatedValuesLock.attemptReadLock(-1); try { Object[] id = this.generatedValues.get(table); this.generatedValuesLock.releaseReadLock();
/** * An attempt to acquire reader lock should succeed when there are no writer * locks already taken (by calling {@link #attemptWriteLock}). The owner * argument is ignored since this is a non-reentrant lock and the behaviour is * identical to {@link #attemptReadLock(long)}. * * @param msecs * The timeout to wait for lock acquisition before failing. A value * equal to zero means not to wait at all, while a value less than * zero means to wait indefinitely. * * @return true if lock acquired successfully, false if the attempt timed out */ public final boolean attemptReadLock(long msecs, Object owner) { return attemptReadLock(msecs); }
UnsharedImageState(final boolean isClient, final boolean isReplicate, final boolean isLocal, final boolean mayDoRecovery, CancelCriterion stopper) { this.riLock = isClient ? new StoppableReentrantReadWriteLock(stopper) : null; this.giiLock = isReplicate ? new StoppableNonReentrantLock(stopper) : null; initDestroyedKeysMap(); initDeltaKeysSet(); initVersionTagsSet(); initFailedMembersSet(); this.mayDoRecovery = mayDoRecovery; if (mayDoRecovery) { this.inRecovery = true; // default to true to fix 41147 } // we don't actually require much concurrency since putter will be only // the GII thread, but for multiple getters this is a concurrent set this.failedEvents = new ConcurrentTHashSet<EventID>(2); this.pendingTXRegionStates = isLocal ? null : new THashMapWithCreate(); this.pendingTXRegionStatesLock = isLocal ? null : new NonReentrantReadWriteLock(stopper); this.pendingTXOrder = new AtomicInteger(0); }