Search in sources :

Example 56 with ForceReattemptException

use of org.apache.geode.internal.cache.ForceReattemptException in project geode by apache.

the class GetMessage method send.

/**
   * Sends a PartitionedRegion {@link org.apache.geode.cache.Region#get(Object)} message
   * 
   * @param recipient the member that the get message is sent to
   * @param r the PartitionedRegion for which get was performed upon
   * @param key the object to which the value should be feteched
   * @param requestingClient the client cache that requested this item
   * @return the processor used to fetch the returned value associated with the key
   * @throws ForceReattemptException if the peer is no longer available
   */
public static GetResponse send(InternalDistributedMember recipient, PartitionedRegion r, final Object key, final Object aCallbackArgument, ClientProxyMembershipID requestingClient, boolean returnTombstones) throws ForceReattemptException {
    Assert.assertTrue(recipient != null, "PRDistribuedGetReplyMessage NULL reply message");
    GetResponse p = new GetResponse(r.getSystem(), Collections.singleton(recipient), key);
    GetMessage m = new GetMessage(recipient, r.getPRId(), p, key, aCallbackArgument, requestingClient, returnTombstones);
    Set failures = r.getDistributionManager().putOutgoing(m);
    if (failures != null && failures.size() > 0) {
        throw new ForceReattemptException(LocalizedStrings.GetMessage_FAILED_SENDING_0.toLocalizedString(m));
    }
    return p;
}
Also used : Set(java.util.Set) ForceReattemptException(org.apache.geode.internal.cache.ForceReattemptException)

Example 57 with ForceReattemptException

use of org.apache.geode.internal.cache.ForceReattemptException in project geode by apache.

the class InterestEventMessage method operateOnPartitionedRegion.

@Override
protected boolean operateOnPartitionedRegion(final DistributionManager dm, PartitionedRegion r, long startTime) throws ForceReattemptException {
    if (logger.isTraceEnabled(LogMarker.DM)) {
        logger.debug("InterestEventMessage operateOnPartitionedRegion: {}", r.getFullPath());
    }
    PartitionedRegionDataStore ds = r.getDataStore();
    if (ds != null) {
        try {
            ds.handleInterestEvent(this.event);
            r.getPrStats().endPartitionMessagesProcessing(startTime);
            InterestEventReplyMessage.send(getSender(), getProcessorId(), dm);
        } catch (Exception e) {
            sendReply(getSender(), getProcessorId(), dm, new ReplyException(new ForceReattemptException("Caught exception during interest registration processing:", e)), r, startTime);
            return false;
        }
    } else {
        throw new InternalError("InterestEvent message was sent to a member with no storage.");
    }
    // response
    return false;
}
Also used : ForceReattemptException(org.apache.geode.internal.cache.ForceReattemptException) PartitionedRegionDataStore(org.apache.geode.internal.cache.PartitionedRegionDataStore) ReplyException(org.apache.geode.distributed.internal.ReplyException) ForceReattemptException(org.apache.geode.internal.cache.ForceReattemptException) IOException(java.io.IOException) CacheException(org.apache.geode.cache.CacheException) ReplyException(org.apache.geode.distributed.internal.ReplyException)

Example 58 with ForceReattemptException

use of org.apache.geode.internal.cache.ForceReattemptException in project geode by apache.

the class InvalidateMessage method send.

/**
   * Sends an InvalidateMessage {@link org.apache.geode.cache.Region#invalidate(Object)}message to
   * the recipient
   * 
   * @param recipient the recipient of the message
   * @param r the PartitionedRegion for which the invalidate was performed
   * @param event the event causing this message
   * @return the InvalidateResponse processor used to await the potential
   *         {@link org.apache.geode.cache.CacheException}
   * @throws ForceReattemptException if the peer is no longer available
   */
public static InvalidateResponse send(DistributedMember recipient, PartitionedRegion r, EntryEventImpl event) throws ForceReattemptException {
    // Assert.assertTrue(recipient != null, "InvalidateMessage NULL recipient"); recipient may be
    // null for remote notifications
    Set recipients = Collections.singleton(recipient);
    InvalidateResponse p = new InvalidateResponse(r.getSystem(), recipients, event.getKey());
    InvalidateMessage m = new InvalidateMessage(recipients, false, r.getPRId(), p, event);
    Set failures = r.getDistributionManager().putOutgoing(m);
    if (failures != null && failures.size() > 0) {
        throw new ForceReattemptException(LocalizedStrings.InvalidateMessage_FAILED_SENDING_0.toLocalizedString(m));
    }
    return p;
}
Also used : Set(java.util.Set) ForceReattemptException(org.apache.geode.internal.cache.ForceReattemptException)

Example 59 with ForceReattemptException

use of org.apache.geode.internal.cache.ForceReattemptException in project geode by apache.

the class ManageBackupBucketMessage method send.

/**
   * Sends a PartitionedRegion manage bucket request to the recipient
   * 
   * @param recipient the member to which the bucket manage request is sent
   * @param r the PartitionedRegion to which the bucket belongs
   * @param bucketId the unique identifier of the bucket
   * @param isRebalance true if directed by full rebalance operation
   * @param replaceOfflineData
   * @param moveSource If this is a bucket move.
   * @param forceCreation ignore checks which may cause the bucket not to be created
   * @return the processor used to fetch the returned Node if any
   * @throws ForceReattemptException if the peer is no longer available
   */
public static NodeResponse send(InternalDistributedMember recipient, PartitionedRegion r, int bucketId, boolean isRebalance, boolean replaceOfflineData, InternalDistributedMember moveSource, boolean forceCreation) throws ForceReattemptException {
    Assert.assertTrue(recipient != null, "ManageBucketMessage NULL recipient");
    NodeResponse p = new NodeResponse(r.getSystem(), recipient);
    ManageBackupBucketMessage m = new ManageBackupBucketMessage(recipient, r.getPRId(), p, bucketId, isRebalance, replaceOfflineData, moveSource, forceCreation);
    p.enableSevereAlertProcessing();
    Set failures = r.getDistributionManager().putOutgoing(m);
    if (failures != null && failures.size() > 0) {
        throw new ForceReattemptException("Failed sending <" + m + ">");
    }
    return p;
}
Also used : Set(java.util.Set) ForceReattemptException(org.apache.geode.internal.cache.ForceReattemptException)

Example 60 with ForceReattemptException

use of org.apache.geode.internal.cache.ForceReattemptException in project geode by apache.

the class ManageBucketMessage method send.

/**
   * Sends a PartitionedRegion manage bucket request to the recipient
   * 
   * @param recipient the member to which the bucket manage request is sent
   * @param r the PartitionedRegion to which the bucket belongs
   * @param bucketId the unique identifier of the bucket
   * @param bucketSize the size in bytes of the bucket
   * @param forceCreation inform the recipient to accept the bucket appropriately ignoring maximums
   * @return the processor used to fetch the returned Node if any
   * @throws ForceReattemptException if the peer is no longer available
   */
public static NodeResponse send(InternalDistributedMember recipient, PartitionedRegion r, int bucketId, int bucketSize, boolean forceCreation) throws ForceReattemptException {
    Assert.assertTrue(recipient != null, "ManageBucketMessage NULL recipient");
    NodeResponse p = new NodeResponse(r.getSystem(), recipient);
    ManageBucketMessage m = new ManageBucketMessage(recipient, r.getPRId(), p, bucketId, bucketSize, forceCreation);
    p.enableSevereAlertProcessing();
    Set failures = r.getDistributionManager().putOutgoing(m);
    if (failures != null && failures.size() > 0) {
        throw new ForceReattemptException(LocalizedStrings.ManageBucketMessage_FAILED_SENDING_0.toLocalizedString(m));
    }
    return p;
}
Also used : Set(java.util.Set) ForceReattemptException(org.apache.geode.internal.cache.ForceReattemptException)

Aggregations

ForceReattemptException (org.apache.geode.internal.cache.ForceReattemptException)62 Set (java.util.Set)21 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)13 FunctionException (org.apache.geode.cache.execute.FunctionException)12 ReplyException (org.apache.geode.distributed.internal.ReplyException)11 PrimaryBucketException (org.apache.geode.internal.cache.PrimaryBucketException)11 PartitionedRegionDataStore (org.apache.geode.internal.cache.PartitionedRegionDataStore)9 TransactionException (org.apache.geode.cache.TransactionException)8 HashSet (java.util.HashSet)7 CacheException (org.apache.geode.cache.CacheException)7 RegionDestroyedException (org.apache.geode.cache.RegionDestroyedException)7 InternalDistributedMember (org.apache.geode.distributed.internal.membership.InternalDistributedMember)6 CacheClosedException (org.apache.geode.cache.CacheClosedException)5 TransactionDataNodeHasDepartedException (org.apache.geode.cache.TransactionDataNodeHasDepartedException)5 Host (org.apache.geode.test.dunit.Host)5 VM (org.apache.geode.test.dunit.VM)5 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)5 Test (org.junit.Test)5 LinkedList (java.util.LinkedList)4 List (java.util.List)4