final InvalidateResponse p = new InvalidateResponse(r.getSystem(), recipients, event.getKey(), tx); final InvalidateMessage m = new InvalidateMessage(recipients, false,
/** * Processes this message. This method is invoked by the receiver * of the message. * @param dm the distribution manager that is processing the message. */ @Override public void process(final DM dm, final ReplyProcessor21 rp) { final long startTime = getTimestamp(); if (logger.isTraceEnabled(LogMarker.DM)) { logger.trace(LogMarker.DM, "InvalidateReplyMessage process invoking reply processor with processorId: {}", this.processorId); } if (rp == null) { if (logger.isTraceEnabled(LogMarker.DM)) { logger.trace(LogMarker.DM, "InvalidateReplyMessage processor not found"); } return; } if (rp instanceof InvalidateResponse) { InvalidateResponse processor = (InvalidateResponse)rp; processor.setResponse(this); } rp.process(this); if (logger.isTraceEnabled(LogMarker.DM)) { logger.trace(LogMarker.DM, "{} processed {}", rp, this); } dm.getStats().incReplyMessageTime(NanoTimer.getTime()-startTime); }
this.prStats.incPartitionMessagesSent(); try { response.waitForResult(); event.setVersionTag(response.versionTag); return;
processor.setResponse(this);
/** * Sends an InvalidateMessage * {@link com.gemstone.gemfire.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 com.gemstone.gemfire.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; }
/** * Prepares an InvalidateMessage * {@link com.gemstone.gemfire.cache.Region#invalidate(Object)} for send to * the recipient. * * @param sys * the distributed system * @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 prepared InvalidateMessage */ public static InvalidateMessage prepareSend( final InternalDistributedSystem sys, final InternalDistributedMember recipient, final PartitionedRegion r, final EntryEventImpl event) { // recipient may be null for remote notifications //Assert.assertTrue(recipient != null, "InvalidateMessage NULL recipient"); final TXStateInterface tx = event.getTXState(r); final InvalidateResponse p = new InvalidateResponse(sys, recipient, event.getKey(), tx); final InvalidateMessage m = new InvalidateMessage(recipient, false, r.getPRId(), p, event, tx); return m; }
/** * @throws ForceReattemptException if the peer is no longer available * @throws CacheException if the peer generates an error */ public final void waitForResult() throws CacheException, PrimaryBucketException, ForceReattemptException { try { waitForCacheException(); } catch (ForceReattemptException e) { e.checkKey(key); throw e; } if (!this.returnValueReceived) { throw new ForceReattemptException( LocalizedStrings.InvalidateMessage_NO_RESPONSE_CODE_RECEIVED .toLocalizedString()); } } }
/** * @throws ForceReattemptException if the peer is no longer available * @throws CacheException if the peer generates an error */ public void waitForResult() throws CacheException, ForceReattemptException { try { waitForCacheException(); } catch (ForceReattemptException e) { e.checkKey(key); throw e; } if (!this.returnValueReceived) { throw new ForceReattemptException(LocalizedStrings.InvalidateMessage_NO_RESPONSE_CODE_RECEIVED.toLocalizedString()); } return; } }
protected final void waitForRemoteInvalidate( final InvalidateResponse response, final Object recipients, final EntryEventImpl event) throws EntryNotFoundException, PrimaryBucketException, ForceReattemptException { try { response.waitForResult(); event.setVersionTag(response.versionTag); } catch (EntryNotFoundException enfe) { throw enfe; } catch (TransactionException te) { throw te; } catch (CacheException ce) { throw new PartitionedRegionException( LocalizedStrings.PartitionedRegion_INVALIDATION_OF_ENTRY_ON_0_FAILED .toLocalizedString(recipients), ce); } }
PartitionResponse createReplyProcessor(PartitionedRegion r, Set recipients, Object key) { return new InvalidateResponse(r.getSystem(), recipients, key); }
public final Map<InternalDistributedMember, ReplyException> getResponseExceptions(InvalidateMessage.InvalidateResponse response) { return response.getExceptions(); } };