Search in sources :

Example 1 with LockGrantorId

use of org.apache.geode.distributed.internal.locks.LockGrantorId in project geode by apache.

the class TXLockServiceImpl method updateParticipants.

@Override
public void updateParticipants(TXLockId txLockId, final Set updatedParticipants) {
    synchronized (this.txLockIdList) {
        if (!this.txLockIdList.contains(txLockId)) {
            throw new IllegalArgumentException(LocalizedStrings.TXLockServiceImpl_INVALID_TXLOCKID_NOT_FOUND_0.toLocalizedString(txLockId));
        }
    }
    if (updatedParticipants == null) {
        throw new IllegalArgumentException(LocalizedStrings.TXLockServiceImpl_INVALID_UPDATEDPARTICIPANTS_NULL.toLocalizedString());
    }
    if (updatedParticipants.isEmpty()) {
        return;
    }
    if (!this.recovering) {
        // Serializable grantorId = this.dlock.getLockGrantorId();
        if (this.dlock.isLockGrantor()) {
            // Don't need to send a message (or wait for a reply)
            // logger.info("DEBUG: [TXLockServiceImpl.updateParticipants] this VM is the Grantor");
            TXLockUpdateParticipantsMessage.updateParticipants(this.dlock, txLockId, updatedParticipants);
        } else {
            // not lock grantor
            LockGrantorId lockGrantorId = txLockId.getLockGrantorId();
            if (lockGrantorId == null || !this.dlock.isLockGrantorId(lockGrantorId)) {
                // grantor is gone so we cannot update him
                return;
            }
            InternalDistributedMember grantorId = lockGrantorId.getLockGrantorMember();
            // logger.info("DEBUG: [TXLockServiceImpl.updateParticipants] sending update message to
            // Grantor " + grantorId);
            ReplyProcessor21 processor = new ReplyProcessor21(this.dlock.getDistributionManager(), grantorId);
            TXLockUpdateParticipantsMessage dlup = new TXLockUpdateParticipantsMessage(txLockId, this.dlock.getName(), updatedParticipants, processor.getProcessorId());
            dlup.setRecipient(grantorId);
            this.dlock.getDistributionManager().putOutgoing(dlup);
            // for() loop removed for bug 36983 - you can't loop on waitForReplies()
            this.dlock.getDistributionManager().getCancelCriterion().checkCancelInProgress(null);
            try {
                processor.waitForRepliesUninterruptibly();
            } catch (ReplyException e) {
                e.handleAsUnexpected();
            }
        }
    // not lock grantor
    }
// not recovering
}
Also used : InternalDistributedMember(org.apache.geode.distributed.internal.membership.InternalDistributedMember) LockGrantorId(org.apache.geode.distributed.internal.locks.LockGrantorId) ReplyException(org.apache.geode.distributed.internal.ReplyException) ReplyProcessor21(org.apache.geode.distributed.internal.ReplyProcessor21)

Aggregations

ReplyException (org.apache.geode.distributed.internal.ReplyException)1 ReplyProcessor21 (org.apache.geode.distributed.internal.ReplyProcessor21)1 LockGrantorId (org.apache.geode.distributed.internal.locks.LockGrantorId)1 InternalDistributedMember (org.apache.geode.distributed.internal.membership.InternalDistributedMember)1