Search in sources :

Example 16 with ReplyProcessor21

use of org.apache.geode.distributed.internal.ReplyProcessor21 in project geode by apache.

the class ServerInterestRegistrationMessage method sendInterestChange.

static void sendInterestChange(DM dm, ClientProxyMembershipID clientId, ClientInterestMessageImpl clientInterestMessage) {
    ServerInterestRegistrationMessage registrationMessage = new ServerInterestRegistrationMessage(clientId, clientInterestMessage);
    Set recipients = dm.getOtherDistributionManagerIds();
    registrationMessage.setRecipients(recipients);
    ReplyProcessor21 replyProcessor = new ReplyProcessor21(dm, recipients);
    registrationMessage.processorId = replyProcessor.getProcessorId();
    dm.putOutgoing(registrationMessage);
    try {
        replyProcessor.waitForReplies();
    } catch (InterruptedException ignore) {
        Thread.currentThread().interrupt();
    }
}
Also used : Set(java.util.Set) ReplyProcessor21(org.apache.geode.distributed.internal.ReplyProcessor21)

Example 17 with ReplyProcessor21

use of org.apache.geode.distributed.internal.ReplyProcessor21 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)

Example 18 with ReplyProcessor21

use of org.apache.geode.distributed.internal.ReplyProcessor21 in project geode by apache.

the class FilterProfile method sendFilterProfileOperation.

private void sendFilterProfileOperation(OperationMessage msg) {
    Set recipients = ((DistributionAdvisee) this.region).getDistributionAdvisor().adviseProfileUpdate();
    msg.setRecipients(recipients);
    ReplyProcessor21 rp = new ReplyProcessor21(this.region.getDistributionManager(), recipients);
    msg.processorId = rp.getProcessorId();
    this.region.getDistributionManager().putOutgoing(msg);
    try {
        rp.waitForReplies();
    } catch (InterruptedException ignore) {
        Thread.currentThread().interrupt();
    }
}
Also used : Set(java.util.Set) CopyOnWriteHashSet(org.apache.geode.internal.CopyOnWriteHashSet) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) ReplyProcessor21(org.apache.geode.distributed.internal.ReplyProcessor21)

Example 19 with ReplyProcessor21

use of org.apache.geode.distributed.internal.ReplyProcessor21 in project geode by apache.

the class GemFireCacheImpl method sendAddCacheServerProfileMessage.

private void sendAddCacheServerProfileMessage() {
    Set otherMembers = this.dm.getOtherDistributionManagerIds();
    AddCacheServerProfileMessage message = new AddCacheServerProfileMessage();
    message.operateOnLocalCache(this);
    if (!otherMembers.isEmpty()) {
        if (logger.isDebugEnabled()) {
            logger.debug("Sending add cache server profile message to other members.");
        }
        ReplyProcessor21 replyProcessor = new ReplyProcessor21(this.dm, otherMembers);
        message.setRecipients(otherMembers);
        message.processorId = replyProcessor.getProcessorId();
        this.dm.putOutgoing(message);
        // Wait for replies.
        try {
            replyProcessor.waitForReplies();
        } catch (InterruptedException ignore) {
            Thread.currentThread().interrupt();
        }
    }
}
Also used : CopyOnWriteArraySet(java.util.concurrent.CopyOnWriteArraySet) HashSet(java.util.HashSet) Set(java.util.Set) ConcurrentHashSet(org.apache.geode.internal.concurrent.ConcurrentHashSet) ReplyProcessor21(org.apache.geode.distributed.internal.ReplyProcessor21)

Example 20 with ReplyProcessor21

use of org.apache.geode.distributed.internal.ReplyProcessor21 in project geode by apache.

the class PartitionedRegion method sendInvalidateRegionMessage.

private void sendInvalidateRegionMessage(RegionEventImpl event) {
    final int retryAttempts = calcRetry();
    Throwable thr = null;
    int count = 0;
    while (count <= retryAttempts) {
        try {
            count++;
            Set recipients = getRegionAdvisor().adviseDataStore();
            ReplyProcessor21 response = InvalidatePartitionedRegionMessage.send(recipients, this, event);
            response.waitForReplies();
            thr = null;
            break;
        } catch (ReplyException e) {
            thr = e;
            if (!this.isClosed && !this.isDestroyed) {
                if (logger.isDebugEnabled()) {
                    logger.debug("Invalidating partitioned region caught exception", e);
                }
            }
        } catch (InterruptedException e) {
            thr = e;
            if (!cache.getCancelCriterion().isCancelInProgress()) {
                if (logger.isDebugEnabled()) {
                    logger.debug("Invalidating partitioned region caught exception", e);
                }
            }
        }
    }
    if (thr != null) {
        PartitionedRegionDistributionException e = new PartitionedRegionDistributionException(LocalizedStrings.PartitionedRegion_INVALIDATING_REGION_CAUGHT_EXCEPTION.toLocalizedString(count));
        if (logger.isDebugEnabled()) {
            logger.debug(e.getMessage(), e);
        }
        throw e;
    }
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) ResultsSet(org.apache.geode.cache.query.internal.ResultsSet) PartitionedRegionDistributionException(org.apache.geode.cache.PartitionedRegionDistributionException) ReplyException(org.apache.geode.distributed.internal.ReplyException) ReplyProcessor21(org.apache.geode.distributed.internal.ReplyProcessor21)

Aggregations

ReplyProcessor21 (org.apache.geode.distributed.internal.ReplyProcessor21)28 HashSet (java.util.HashSet)11 Set (java.util.Set)10 DM (org.apache.geode.distributed.internal.DM)7 InternalDistributedMember (org.apache.geode.distributed.internal.membership.InternalDistributedMember)7 ReplyException (org.apache.geode.distributed.internal.ReplyException)5 InternalDistributedSystem (org.apache.geode.distributed.internal.InternalDistributedSystem)4 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)4 HashMap (java.util.HashMap)2 Map (java.util.Map)2 CopyOnWriteArraySet (java.util.concurrent.CopyOnWriteArraySet)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 CancelException (org.apache.geode.CancelException)2 BucketAdvisor (org.apache.geode.internal.cache.BucketAdvisor)2 BucketProfile (org.apache.geode.internal.cache.BucketAdvisor.BucketProfile)2 ConcurrentHashSet (org.apache.geode.internal.concurrent.ConcurrentHashSet)2 Serializable (java.io.Serializable)1 ArrayList (java.util.ArrayList)1 TreeSet (java.util.TreeSet)1 ForcedDisconnectException (org.apache.geode.ForcedDisconnectException)1