/** * send a reply message. This is in a method so that subclasses can override the reply message * type * * @see PutMessage#sendReply */ @Override protected void sendReply(InternalDistributedMember member, int procId, DistributionManager dm, ReplyException ex, PartitionedRegion pr, long startTime) { // if there was an exception, then throw out any data if (ex != null) { this.outStream = null; this.replyMsgNum = 0; this.replyLastMsg = true; } if (this.replyLastMsg) { if (pr != null && startTime > 0) { pr.getPrStats().endPartitionMessagesProcessing(startTime); } } StreamingReplyMessage.send(member, procId, ex, dm, this.outStream, this.numObjectsInChunk, this.replyMsgNum, this.replyLastMsg); }
@Override protected void sendReply(InternalDistributedMember member, int procId, DistributionManager dm, ReplyException ex, PartitionedRegion pr, long startTime) { if (pr != null && startTime > 0) { pr.getPrStats().endPartitionMessagesProcessing(startTime); } InvalidateReplyMessage.send(member, procId, getReplySender(dm), ex, this.versionTag); }
@Override protected boolean operateOnPartitionedRegion(ClusterDistributionManager dm, PartitionedRegion region, long startTime) throws ForceReattemptException { // this is executing in the WAITING_POOL_EXECUTOR try { region.getRedundancyProvider().endBucketCreationLocally(bucketId, newPrimary); } finally { region.getPrStats().endPartitionMessagesProcessing(startTime); } return false; }
/** * send a reply message. This is in a method so that subclasses can override the reply message * type * * @see PutMessage#sendReply */ @Override protected void sendReply(InternalDistributedMember member, int procId, DistributionManager dm, ReplyException ex, PartitionedRegion pr, long startTime) { // if there was an exception, then throw out any data if (ex != null) { this.outStream = null; this.replyMsgNum = 0; this.replyLastMsg = true; } if (this.replyLastMsg) { if (pr != null && startTime > 0) { pr.getPrStats().endPartitionMessagesProcessing(startTime); } } StreamingReplyMessage.send(member, procId, ex, dm, this.outStream, this.numObjectsInChunk, this.replyMsgNum, this.replyLastMsg, this.isPdxSerialized); }
protected void sendReply(InternalDistributedMember member, int procId, DistributionManager dm, ReplyException ex, Object result, PartitionedRegion pr, long startTime, int msgNum, boolean lastResult, boolean sendResultsInOrder) { // if there was an exception, then throw out any data if (ex != null) { this.result = null; this.replyMsgNum = 0; this.replyLastMsg = true; } if (this.replyLastMsg) { if (pr != null && startTime > 0) { pr.getPrStats().endPartitionMessagesProcessing(startTime); } } if (sendResultsInOrder) { FunctionStreamingOrderedReplyMessage.send(member, procId, ex, dm, result, msgNum, lastResult); } else { FunctionStreamingReplyMessage.send(member, procId, ex, dm, result, msgNum, lastResult); } }
/** * Send a generic ReplyMessage. This is in a method so that subclasses can override the reply * message type * * @param pr the Partitioned Region for the message whose statistics are incremented * @param startTime the start time of the operation in nanoseconds * @see PutMessage#sendReply */ protected void sendReply(InternalDistributedMember member, int procId, DistributionManager dm, ReplyException ex, PartitionedRegion pr, long startTime) { if (pr != null && startTime > 0) { pr.getPrStats().endPartitionMessagesProcessing(startTime); } ReplyMessage.send(member, procId, ex, getReplySender(dm), pr != null && pr.isInternalRegion()); }
@Override protected boolean operateOnPartitionedRegion(ClusterDistributionManager dm, PartitionedRegion pr, long startTime) throws CacheException { // This call has come to an uninitialized region. // This can occur as bucket grab Op is done outside the // d-lock. if (pr == null || !pr.isInitialized()) { return false; } if (logger.isTraceEnabled(LogMarker.DM_VERBOSE)) { logger.trace(LogMarker.DM_VERBOSE, "BucketBackupMessage operateOnRegion: {}", pr.getFullPath()); } PartitionedRegionDataStore ds = pr.getDataStore(); if (ds != null) { pr.getRedundancyProvider().finishIncompleteBucketCreation(bucketId); } else { logger.warn("BucketBackupMessage: data store not configured for this member"); } pr.getPrStats().endPartitionMessagesProcessing(startTime); return false; }
@Override protected void sendReply(InternalDistributedMember member, int procId, DistributionManager dm, ReplyException ex, PartitionedRegion pr, long startTime) { if (pr != null) { if (startTime > 0) { pr.getPrStats().endPartitionMessagesProcessing(startTime); } if (!pr.getConcurrencyChecksEnabled() && this.versions != null) { this.versions.clear(); } } RemoveAllReplyMessage.send(member, procId, getReplySender(dm), this.result, this.versions, ex); }
protected void sendReply(InternalDistributedMember member, int procId, DistributionManager dm, ReplyException ex, PartitionedRegion pr, long startTime, EntryEventImpl ev) { if (pr != null && startTime > 0) { pr.getPrStats().endPartitionMessagesProcessing(startTime); pr.getCancelCriterion().checkCancelInProgress(null); // bug 39014 - don't send a positive // response if we may have failed } PutReplyMessage.send(member, procId, getReplySender(dm), result, getOperation(), ex, this, ev); }
@Override protected boolean operateOnPartitionedRegion(ClusterDistributionManager dm, PartitionedRegion region, long startTime) throws ForceReattemptException { PartitionedRegionDataStore dataStore = region.getDataStore(); boolean moved = dataStore.moveBucket(this.bucketId, this.source, true); region.getPrStats().endPartitionMessagesProcessing(startTime); MoveBucketReplyMessage.send(getSender(), getProcessorId(), dm, null, moved); return false; }
@Override protected void sendReply(InternalDistributedMember member, int procId, DistributionManager dm, ReplyException ex, PartitionedRegion pr, long startTime) { // if (!result && getOperation().isCreate()) { // System.err.println("DEBUG: put returning false. ifNew=" + ifNew // +" ifOld="+ifOld + " message=" + this); // } if (pr != null) { if (startTime > 0) { pr.getPrStats().endPartitionMessagesProcessing(startTime); } if (!pr.getConcurrencyChecksEnabled() && this.versions != null) { this.versions.clear(); } } PutAllReplyMessage.send(member, procId, getReplySender(dm), this.result, this.versions, ex); }
@Override protected boolean operateOnPartitionedRegion(ClusterDistributionManager dm, PartitionedRegion pr, long startTime) throws CacheException, ForceReattemptException { if (logger.isTraceEnabled(LogMarker.DM_VERBOSE)) { logger.trace(LogMarker.DM_VERBOSE, "FetchEntriesMessage operateOnRegion: {}", pr.getFullPath()); } PartitionedRegionDataStore ds = pr.getDataStore(); BucketRegion entries = null; if (ds != null) { entries = ds.handleRemoteGetEntries(this.bucketId); if (logger.isTraceEnabled(LogMarker.DM_VERBOSE)) { logger.trace(LogMarker.DM_VERBOSE, "FetchKeysMessage send keys back using processorId: {}", getProcessorId()); } } else { logger.warn("FetchKeysMessage: data store not configured for this member"); } pr.getPrStats().endPartitionMessagesProcessing(startTime); FetchEntriesReplyMessage.send(getSender(), getProcessorId(), dm, this.bucketId, entries); return false; }
@Override protected boolean operateOnPartitionedRegion(ClusterDistributionManager dm, PartitionedRegion region, long startTime) throws ForceReattemptException { PartitionedRegionDataStore dataStore = region.getDataStore(); boolean removed = dataStore.removeBucket(this.bucketId, this.forceRemovePrimary); region.getPrStats().endPartitionMessagesProcessing(startTime); RemoveBucketReplyMessage.send(getSender(), getProcessorId(), dm, null, removed); return false; }
@Override protected boolean operateOnPartitionedRegion(ClusterDistributionManager dm, PartitionedRegion region, long startTime) throws ForceReattemptException { BucketAdvisor bucketAdvisor = region.getRegionAdvisor().getBucketAdvisor(this.bucketId); bucketAdvisor.deposePrimary(); region.getPrStats().endPartitionMessagesProcessing(startTime); DeposePrimaryBucketReplyMessage.send(getSender(), getProcessorId(), dm, (ReplyException) null); return false; }
@Override protected boolean operateOnPartitionedRegion(ClusterDistributionManager dm, PartitionedRegion r, long startTime) throws CacheException, ForceReattemptException { PartitionedRegionDataStore ds = r.getDataStore(); final long size; if (ds != null) { size = ds.getBucketSize(bucketId); } else { // sender thought this member had a data store, but it doesn't throw new ForceReattemptException(String.format("no datastore in %s", dm.getDistributionManagerId())); } r.getPrStats().endPartitionMessagesProcessing(startTime); BucketSizeReplyMessage.send(getSender(), getProcessorId(), dm, size); return false; }
private void sendManageBackupBucketReplyMessage(ClusterDistributionManager dm, PartitionedRegion partitionedRegion, long startTime, ReplyType type) { partitionedRegion.getPrStats().endPartitionMessagesProcessing(startTime); switch (type) { case INITIALIZING: ManageBackupBucketReplyMessage.sendStillInitializing(getSender(), getProcessorId(), dm); break; case FAIL: ManageBackupBucketReplyMessage.sendRefusal(getSender(), getProcessorId(), dm); break; case SUCCESS: ManageBackupBucketReplyMessage.sendAcceptance(getSender(), getProcessorId(), dm); break; default: throw new RuntimeException("unreachable"); } }
@Override protected boolean operateOnPartitionedRegion(ClusterDistributionManager dm, PartitionedRegion region, long startTime) throws ForceReattemptException { // this is executing in the WAITING_POOL_EXECUTOR byte responseCode = BecomePrimaryBucketReplyMessage.NOT_SECONDARY; BucketAdvisor bucketAdvisor = region.getRegionAdvisor().getBucketAdvisor(this.bucketId); if (bucketAdvisor.isHosting()) { if (bucketAdvisor.becomePrimary(this.isRebalance)) { // sends a request/reply message responseCode = BecomePrimaryBucketReplyMessage.OK; } } region.getPrStats().endPartitionMessagesProcessing(startTime); BecomePrimaryBucketReplyMessage.send(getSender(), getProcessorId(), dm, null, responseCode); return false; }
@Override protected void sendReply(InternalDistributedMember member, int procId, DistributionManager dm, ReplyException ex, PartitionedRegion pr, long startTime) { if (pr != null && startTime > 0) { pr.getPrStats().endPartitionMessagesProcessing(startTime); } if (ex == null) { DestroyReplyMessage.send(getSender(), getReplySender(dm), this.processorId, this.versionTag, pr != null && pr.isInternalRegion()); } else { ReplyMessage.send(getSender(), this.processorId, ex, getReplySender(dm), pr != null && pr.isInternalRegion()); } }
@Override protected boolean operateOnPartitionedRegion(final ClusterDistributionManager dm, PartitionedRegion r, long startTime) throws ForceReattemptException { if (logger.isTraceEnabled(LogMarker.DM_VERBOSE)) { logger.trace(LogMarker.DM_VERBOSE, "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."); } // Unless there was an exception thrown, this message handles sending the // response return false; }
@Override protected boolean operateOnPartitionedRegion(ClusterDistributionManager dm, PartitionedRegion region, long startTime) throws ForceReattemptException { PartitionMemberInfoImpl details = (PartitionMemberInfoImpl) region.getRedundancyProvider() .buildPartitionMemberDetails(this.internal, this.loadProbe); OfflineMemberDetails offlineDetails; if (this.internal && this.fetchOfflineMembers) { offlineDetails = region.getRedundancyProvider().fetchOfflineMembers(); } else { offlineDetails = new OfflineMemberDetailsImpl(new Set[0]); } region.getPrStats().endPartitionMessagesProcessing(startTime); FetchPartitionDetailsReplyMessage.send(getSender(), getProcessorId(), details, dm, offlineDetails, null); // Unless there was an exception thrown, this message handles sending the // response return false; }