Search in sources :

Example 1 with DestroyPartitionedRegionResponse

use of org.apache.geode.internal.cache.DestroyPartitionedRegionMessage.DestroyPartitionedRegionResponse in project geode by apache.

the class PartitionedRegion method sendDestroyRegionMessage.

/**
   * Sends the partitioned region specific destroy region message and waits for any responses. This
   * message is also sent in close/localDestroyRegion operation. When it is sent in Cache
   * close/Region close/localDestroyRegion operations, it results in updating of RegionAdvisor on
   * recipient nodes.
   * 
   * @param event the destruction event
   * @param serials the bucket serials hosted locally
   * @see Region#destroyRegion()
   * @see Region#close()
   * @see Region#localDestroyRegion()
   * @see GemFireCacheImpl#close()
   */
private void sendDestroyRegionMessage(RegionEventImpl event, int[] serials) {
    if (this.prRoot == null) {
        if (logger.isDebugEnabled()) {
            logger.debug("Partition region {} failed to initialize. Remove its profile from remote members.", this);
        }
        new UpdateAttributesProcessor(this, true).distribute(false);
        return;
    }
    final HashSet configRecipients = new HashSet(getRegionAdvisor().adviseAllPRNodes());
    // sent a CreateRegionProcessor message, bug 36048
    try {
        final PartitionRegionConfig prConfig = this.prRoot.get(getRegionIdentifier());
        if (prConfig != null) {
            // Fix for bug#34621 by Tushar
            Iterator itr = prConfig.getNodes().iterator();
            while (itr.hasNext()) {
                InternalDistributedMember idm = ((Node) itr.next()).getMemberId();
                if (!idm.equals(getMyId())) {
                    configRecipients.add(idm);
                }
            }
        }
    } catch (CancelException ignore) {
    // ignore
    }
    try {
        DestroyPartitionedRegionResponse resp = DestroyPartitionedRegionMessage.send(configRecipients, this, event, serials);
        resp.waitForRepliesUninterruptibly();
    } catch (ReplyException e) {
        logger.warn(LocalizedMessage.create(LocalizedStrings.PartitionedRegion_PARTITIONEDREGION_SENDDESTROYREGIONMESSAGE_CAUGHT_EXCEPTION_DURING_DESTROYREGIONMESSAGE_SEND_AND_WAITING_FOR_RESPONSE), e);
    }
}
Also used : DestroyPartitionedRegionResponse(org.apache.geode.internal.cache.DestroyPartitionedRegionMessage.DestroyPartitionedRegionResponse) InternalDistributedMember(org.apache.geode.distributed.internal.membership.InternalDistributedMember) PREntriesIterator(org.apache.geode.internal.cache.partitioned.PREntriesIterator) Iterator(java.util.Iterator) CancelException(org.apache.geode.CancelException) ReplyException(org.apache.geode.distributed.internal.ReplyException) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 CancelException (org.apache.geode.CancelException)1 ReplyException (org.apache.geode.distributed.internal.ReplyException)1 InternalDistributedMember (org.apache.geode.distributed.internal.membership.InternalDistributedMember)1 DestroyPartitionedRegionResponse (org.apache.geode.internal.cache.DestroyPartitionedRegionMessage.DestroyPartitionedRegionResponse)1 PREntriesIterator (org.apache.geode.internal.cache.partitioned.PREntriesIterator)1