public void run() { for (int i = 0; i < batches.length; i++) { TXLockBatch batch = (TXLockBatch) batches[i]; // send TXOriginatorDepartureMessage Set participants = batch.getParticipants(); TXOriginatorRecoveryProcessor.sendMessage( participants, owner, batch.getTXLockId(), grantor, dm); } } });
/** * @see Lock#unlock() */ public final void unlock() { tryRelease(); this.sync.signalWaiters(); }
/** Returns (or creates) the instance of the distributed TXLockService */ public static TXLockService createDTLS() { synchronized (TXLockService.class) { if (DTLS == null || DTLS.isDestroyed()) { DTLS = new TXLockServiceImpl(DLockService.DTLS); } return DTLS; } }
/** * 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(); }
/** * Releases in shared mode. Implemented by unblocking one or more threads if * {@link #tryReleaseShared(int, Object, Object)} returns true. * * @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 releaseReadLock() { tryReleaseShared(); this.sync.signalSharedWaiters(); }
/** * @see ExclusiveSharedSynchronizer#setOwnerId(Object, Object) */ @Override protected final void setOwnerId(Object owner, Object context) { this.ownerId = owner; this.sync.setOwnerThread(); }
/** * Returns an estimate of the number of threads waiting to acquire this lock. * The value is only an estimate because the number of threads may change * dynamically while this method traverses internal data structures. This * method is designed for use in monitoring of the system state, not for * synchronization control. * * @return the estimated number of threads waiting for this lock */ public final int getQueueLength() { return this.sync.getQueueLength(); }
public static final TXLockIdImpl createFromData(DataInput in) throws IOException, ClassNotFoundException { TXLockIdImpl result = new TXLockIdImpl(); result.fromData(in); return result; }
@Override public final Object lockForRead(final ExclusiveSharedLockObject lockObj, LockMode mode, Object lockOwner, final Object context, final int iContext, AbstractOperationMessage msg, boolean allowTombstones, ReadEntryUnderLock reader) { // no locking to be done return reader.readEntry(lockObj, context, iContext, allowTombstones); }
/** * @see Checkpoint#releaseLock() */ public void releaseLock() { this.sync.releaseLock(); }
@Override public final void acquireLock(final ExclusiveSharedLockObject lockObj, final LockMode mode, final int flags, final Object lockOwner, final Object context, final AbstractOperationMessage msg) throws ConflictException, LockTimeoutException { acquireLockFailFast(lockObj, mode, flags, lockOwner, context, msg); }
@Override public final boolean lockedForWrite(ExclusiveSharedLockObject lockObj, Object owner, Object context) { return lockObj.hasExclusiveLock(owner, context); } },
/** * Returns true if the given lock object currently has a write lock (as * returned by {@link #getWriteLockMode()}) held on it. */ public boolean lockedForWrite(final ExclusiveSharedLockObject lockObj, final Object owner, final Object context) { return lockObj.hasExclusiveSharedLock(owner, context); }
/** * @see MapCallback#oldValueRead(Object) */ @Override public final void oldValueRead(final QueuedSynchronizer sync) { // we are getting the queue for reading so increment the number // of waiters conservatively sync.incrementNumWaiters(); }
@Override public final Object lockForRead(final ExclusiveSharedLockObject lockObj, final LockMode mode, final Object lockOwner, final Object context, final int iContext, final AbstractOperationMessage msg, boolean allowTombstones, ReadEntryUnderLock reader) { // currently only CONFLICT_WITH_EX flag is honoured; if more flags are // added then ensure that none overlap with those in ReadEntryUnderLock acquireLockFailFast(lockObj, mode, (iContext & ExclusiveSharedSynchronizer.CONFLICT_WITH_EX), lockOwner, context, msg); return Locked; }
@Override public final void acquireLock(final ExclusiveSharedLockObject lockObj, final LockMode mode, final int flags, final Object lockOwner, final Object context, final AbstractOperationMessage msg) throws ConflictException, LockTimeoutException { acquireLockFailFast(lockObj, mode, flags, lockOwner, context, msg); }
@Override public final long getTimeout(final Object lockObj, final LockMode newMode, final LockMode currentMode, final int flags, final long msecs) { return getTimeoutFailFast(lockObj, newMode, currentMode, flags); }
/** * 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(); }
@Override public final Object lockForRead(final ExclusiveSharedLockObject lockObj, LockMode mode, Object lockOwner, final Object context, final int iContext, AbstractOperationMessage msg, boolean allowTombstones, ReadEntryUnderLock reader) { // TODO: Suranjan try to see if we can add versioning information here and read return reader.readEntry(lockObj, context, iContext, allowTombstones); } },