Search in sources :

Example 56 with ReplyException

use of org.apache.geode.distributed.internal.ReplyException 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 57 with ReplyException

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

the class FinishBackupRequest method send.

public static Map<DistributedMember, Set<PersistentID>> send(DM dm, Set recipients, File targetDir, File baselineDir, boolean abort) {
    FinishBackupRequest request = new FinishBackupRequest(targetDir, baselineDir, abort);
    request.setRecipients(recipients);
    FinishBackupReplyProcessor replyProcessor = new FinishBackupReplyProcessor(dm, recipients);
    request.msgId = replyProcessor.getProcessorId();
    dm.putOutgoing(request);
    try {
        replyProcessor.waitForReplies();
    } catch (ReplyException e) {
        if (!(e.getCause() instanceof CancelException)) {
            throw e;
        }
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    AdminResponse response = request.createResponse((DistributionManager) dm);
    response.setSender(dm.getDistributionManagerId());
    replyProcessor.process(response);
    return replyProcessor.results;
}
Also used : AdminResponse(org.apache.geode.internal.admin.remote.AdminResponse) CancelException(org.apache.geode.CancelException) ReplyException(org.apache.geode.distributed.internal.ReplyException)

Example 58 with ReplyException

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

the class FlushToDiskRequest method send.

public static void send(DM dm, Set recipients) {
    FlushToDiskRequest request = new FlushToDiskRequest();
    request.setRecipients(recipients);
    FlushToDiskProcessor replyProcessor = new FlushToDiskProcessor(dm, recipients);
    request.msgId = replyProcessor.getProcessorId();
    dm.putOutgoing(request);
    try {
        replyProcessor.waitForReplies();
    } catch (ReplyException e) {
        if (!(e.getCause() instanceof CancelException)) {
            throw e;
        }
    } catch (InterruptedException e) {
        logger.debug(e);
    }
    AdminResponse response = request.createResponse((DistributionManager) dm);
    response.setSender(dm.getDistributionManagerId());
    replyProcessor.process(response);
}
Also used : AdminResponse(org.apache.geode.internal.admin.remote.AdminResponse) CancelException(org.apache.geode.CancelException) ReplyException(org.apache.geode.distributed.internal.ReplyException)

Example 59 with ReplyException

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

the class NonGrantorDestroyedProcessor method send.

////////// Public static entry point /////////
/**
   * 
   * Send a message to grantor telling him that we've shutdown the named lock service for this
   * member.
   * <p>
   * Caller should loop, getting the grantor, calling <code>send</code>, and checking
   * <code>informedGrantor()</code> until the grantor has acknowledged being informed.
   */
static boolean send(String serviceName, LockGrantorId theLockGrantorId, DM dm) {
    InternalDistributedMember recipient = theLockGrantorId.getLockGrantorMember();
    NonGrantorDestroyedProcessor processor = new NonGrantorDestroyedProcessor(dm, recipient);
    NonGrantorDestroyedMessage.send(serviceName, recipient, dm, processor);
    try {
        processor.waitForRepliesUninterruptibly();
    } catch (ReplyException e) {
        e.handleAsUnexpected();
    }
    return processor.informedGrantor();
}
Also used : InternalDistributedMember(org.apache.geode.distributed.internal.membership.InternalDistributedMember) ReplyException(org.apache.geode.distributed.internal.ReplyException)

Example 60 with ReplyException

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

the class DeposeGrantorProcessor method send.

////////// Public static entry point /////////
/**
   * Send a message to oldGrantor telling him that he is deposed by newGrantor. Send does not
   * complete until an ack is received or the oldGrantor leaves the system.
   */
static void send(String serviceName, InternalDistributedMember oldGrantor, InternalDistributedMember newGrantor, long newGrantorVersion, int newGrantorSerialNumber, DM dm) {
    final InternalDistributedMember elder = dm.getId();
    if (elder.equals(oldGrantor)) {
        doOldGrantorWork(serviceName, elder, newGrantor, newGrantorVersion, newGrantorSerialNumber, dm, null);
    } else {
        DeposeGrantorProcessor processor = new DeposeGrantorProcessor(dm, oldGrantor);
        DeposeGrantorMessage.send(serviceName, oldGrantor, newGrantor, newGrantorVersion, newGrantorSerialNumber, dm, processor);
        try {
            processor.waitForRepliesUninterruptibly();
        } catch (ReplyException e) {
            e.handleAsUnexpected();
        }
    }
}
Also used : InternalDistributedMember(org.apache.geode.distributed.internal.membership.InternalDistributedMember) ReplyException(org.apache.geode.distributed.internal.ReplyException)

Aggregations

ReplyException (org.apache.geode.distributed.internal.ReplyException)75 CancelException (org.apache.geode.CancelException)24 InternalDistributedMember (org.apache.geode.distributed.internal.membership.InternalDistributedMember)20 Set (java.util.Set)16 RegionDestroyedException (org.apache.geode.cache.RegionDestroyedException)16 HashSet (java.util.HashSet)12 ForceReattemptException (org.apache.geode.internal.cache.ForceReattemptException)10 EntryNotFoundException (org.apache.geode.cache.EntryNotFoundException)8 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)8 IOException (java.io.IOException)7 CacheClosedException (org.apache.geode.cache.CacheClosedException)7 ReplyMessage (org.apache.geode.distributed.internal.ReplyMessage)7 Cache (org.apache.geode.cache.Cache)6 CacheException (org.apache.geode.cache.CacheException)6 Region (org.apache.geode.cache.Region)6 PartitionedRegionDataStore (org.apache.geode.internal.cache.PartitionedRegionDataStore)6 PrimaryBucketException (org.apache.geode.internal.cache.PrimaryBucketException)6 Released (org.apache.geode.internal.offheap.annotations.Released)6 DistributedSystemDisconnectedException (org.apache.geode.distributed.DistributedSystemDisconnectedException)5 ReplyProcessor21 (org.apache.geode.distributed.internal.ReplyProcessor21)5