Search in sources :

Example 21 with ReplyProcessor21

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

the class ReleaseClearLockMessage method send.

public static void send(Set<InternalDistributedMember> members, DM dm, String regionPath) throws ReplyException {
    ReplyProcessor21 processor = new ReplyProcessor21(dm, members);
    ReleaseClearLockMessage msg = new ReleaseClearLockMessage(regionPath, processor.getProcessorId());
    msg.setRecipients(members);
    dm.putOutgoing(msg);
    processor.waitForRepliesUninterruptibly();
}
Also used : ReplyProcessor21(org.apache.geode.distributed.internal.ReplyProcessor21)

Example 22 with ReplyProcessor21

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

the class DestroyRegionOnDataStoreMessage method send.

/**
   * Sends a DestroyRegionOnDataStoreMessage requesting that another VM destroy an existing region
   * 
   */
public static void send(InternalDistributedMember recipient, PartitionedRegion r, Object callbackArg) {
    DM dm = r.getDistributionManager();
    ReplyProcessor21 rp = new ReplyProcessor21(dm, recipient);
    int procId = rp.getProcessorId();
    DestroyRegionOnDataStoreMessage m = new DestroyRegionOnDataStoreMessage(recipient, r.getPRId(), rp, callbackArg);
    r.getDistributionManager().putOutgoing(m);
    rp.waitForRepliesUninterruptibly();
}
Also used : DM(org.apache.geode.distributed.internal.DM) ReplyProcessor21(org.apache.geode.distributed.internal.ReplyProcessor21)

Example 23 with ReplyProcessor21

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

the class EndBucketCreationMessage method send.

/**
   * Sends a message to make the recipient primary for the bucket.
   * 
   * @param acceptedMembers
   * 
   * @param newPrimary the member to to become primary
   * @param pr the PartitionedRegion of the bucket
   * @param bid the bucket to become primary for
   */
public static void send(Collection<InternalDistributedMember> acceptedMembers, InternalDistributedMember newPrimary, PartitionedRegion pr, int bid) {
    Assert.assertTrue(newPrimary != null, "VolunteerPrimaryBucketMessage NULL recipient");
    ReplyProcessor21 response = new ReplyProcessor21(pr.getSystem(), acceptedMembers);
    EndBucketCreationMessage msg = new EndBucketCreationMessage(acceptedMembers, pr.getPRId(), response, bid, newPrimary);
    pr.getDistributionManager().putOutgoing(msg);
}
Also used : ReplyProcessor21(org.apache.geode.distributed.internal.ReplyProcessor21)

Example 24 with ReplyProcessor21

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

the class FlushMessage method process.

/*
   * Used both for the reciept of a FlushMessage and the reply to a Flushmessage
   */
@Override
protected void process(DistributionManager dm) {
    if (this.bucketId != Integer.MIN_VALUE) {
        if (logger.isDebugEnabled()) {
            logger.debug("Received sent FlushMessage {}", this);
        }
        try {
            final PartitionedRegion p = PartitionedRegion.getPRFromId(this.prId);
            Assert.assertTrue(p.getRegionAdvisor().isPrimaryForBucket(this.bucketId));
        } catch (PRLocallyDestroyedException fre) {
            if (logger.isDebugEnabled()) {
                logger.debug("Sending reply despite Region getting locally destroyed prId={}", this.prId, fre);
            }
        } catch (CacheRuntimeException ce) {
            logger.debug("Sending reply despite unavailable Partitioned Region using prId={}", this.prId, ce);
        } finally {
            dm.putOutgoing(new FlushMessage(this.prId, Integer.MIN_VALUE, getProcessorId(), getSender()));
        }
    } else {
        if (logger.isDebugEnabled()) {
            logger.debug("Processing FlushMessage as a response {}", this);
        }
        ReplyProcessor21 rep = ReplyProcessor21.getProcessor(this.processorId);
        if (rep != null) {
            rep.process(this);
        }
    }
}
Also used : CacheRuntimeException(org.apache.geode.cache.CacheRuntimeException) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) ReplyProcessor21(org.apache.geode.distributed.internal.ReplyProcessor21)

Example 25 with ReplyProcessor21

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

the class AcceptorImpl method notifyCacheMembersOfClose.

private void notifyCacheMembersOfClose() {
    if (!this.cache.forcedDisconnect()) {
        for (PartitionedRegion pr : this.cache.getPartitionedRegions()) {
            Map<Integer, BucketAdvisor.BucketProfile> profiles = new HashMap<>();
            // get all local real bucket advisors
            Map<Integer, BucketAdvisor> advisors = pr.getRegionAdvisor().getAllBucketAdvisors();
            for (Map.Entry<Integer, BucketAdvisor> entry : advisors.entrySet()) {
                BucketAdvisor advisor = entry.getValue();
                BucketProfile bp = (BucketProfile) advisor.createProfile();
                advisor.updateServerBucketProfile(bp);
                profiles.put(entry.getKey(), bp);
            }
            Set recipients = pr.getRegionAdvisor().adviseAllPRNodes();
            // send it to all in one message
            ReplyProcessor21 reply = AllBucketProfilesUpdateMessage.send(recipients, pr.getDistributionManager(), pr.getPRId(), profiles, true);
            if (reply != null) {
                reply.waitForRepliesUninterruptibly();
            }
            if (logger.isDebugEnabled()) {
                logger.debug("sending messages to all peers for removing this server..");
            }
        }
    }
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Set(java.util.Set) HashSet(java.util.HashSet) HashMap(java.util.HashMap) BucketProfile(org.apache.geode.internal.cache.BucketAdvisor.BucketProfile) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) BucketAdvisor(org.apache.geode.internal.cache.BucketAdvisor) Map(java.util.Map) HashMap(java.util.HashMap) 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