コード例 #1
0
 public void sendResult(Object oneResult) {
   if (!this.function.hasResult()) {
     throw new IllegalStateException(
         LocalizedStrings.ExecuteFunction_CANNOT_0_RESULTS_HASRESULT_FALSE.toLocalizedString(
             "send"));
   }
   if (this.serverSender != null) { // Client-Server
     if (dm.getLoggerI18n().fineEnabled()) {
       dm.getLoggerI18n()
           .fine(
               "MemberFunctionResultSender sending result from local node to client " + oneResult);
     }
     this.serverSender.sendResult(oneResult);
   } else { // P2P
     if (this.msg != null) {
       try {
         this.msg.sendReplyForOneResult(dm, oneResult, false, enableOrderedResultStreming, false);
       } catch (QueryException e) {
         throw new FunctionException(e);
       } catch (ForceReattemptException e) {
         throw new FunctionException(e);
       } catch (InterruptedException e) {
         throw new FunctionException(e);
       }
     } else {
       this.rc.addResult(this.dm.getDistributionManagerId(), oneResult);
       FunctionStats.getFunctionStats(function.getId(), this.dm.getSystem()).incResultsReceived();
     }
     // incrementing result sent stats.
     FunctionStats.getFunctionStats(function.getId(), this.dm.getSystem()).incResultsReturned();
   }
 }
コード例 #2
0
 public StateFlushReplyProcessor(DM manager, Set initMembers, DistributedMember target) {
   super(manager, initMembers);
   this.targetMember = (InternalDistributedMember) target;
   this.originalCount = initMembers.size();
   this.targetMemberHasLeft =
       targetMemberHasLeft // bug #43583 - perform an initial membership check
           || !manager.isCurrentMember((InternalDistributedMember) target);
 }
コード例 #3
0
 /** flush current ops to the given members for the given region */
 public static void flushTo(Set<InternalDistributedMember> targets, DistributedRegion region) {
   DM dm = region.getDistributionManager();
   DistributedRegion r = region;
   boolean initialized = r.isInitialized();
   if (initialized) {
     r.getDistributionAdvisor()
         .forceNewMembershipVersion(); // force a new "view" so we can track current ops
     try {
       r.getDistributionAdvisor().waitForCurrentOperations();
     } catch (RegionDestroyedException e) {
       return;
     }
   }
   // send all state-flush messages and then wait for replies
   Set<ReplyProcessor21> processors = new HashSet<ReplyProcessor21>();
   for (InternalDistributedMember target : targets) {
     StateStabilizationMessage gr = new StateStabilizationMessage();
     gr.isSingleFlushTo = true; // new for flushTo operation
     gr.requestingMember = dm.getDistributionManagerId();
     gr.setRecipient(target);
     ReplyProcessor21 processor = new ReplyProcessor21(dm, target);
     gr.processorId = processor.getProcessorId();
     gr.channelState = dm.getMembershipManager().getMessageState(target, false);
     if (logger.isTraceEnabled(LogMarker.STATE_FLUSH_OP)
         && ((gr.channelState != null) && (gr.channelState.size() > 0))) {
       logger.trace(
           LogMarker.STATE_FLUSH_OP,
           "channel states: {}",
           gr.channelStateDescription(gr.channelState));
     }
     if (logger.isTraceEnabled(LogMarker.STATE_FLUSH_OP)) {
       logger.trace(LogMarker.STATE_FLUSH_OP, "Sending {}", gr);
     }
     dm.putOutgoing(gr);
     processors.add(processor);
   }
   for (ReplyProcessor21 processor : processors) {
     try {
       processor.waitForReplies();
     } catch (InterruptedException e) {
       Thread.currentThread().interrupt();
       return;
     }
   }
 }
 /**
  * Send a profile update to a set of members.
  *
  * @param recipients the set of members to be notified
  * @param dm the distribution manager used to send the message
  * @param prId the unique partitioned region identifier
  * @param profiles bucked id to profile map
  * @param requireAck whether or not to expect a reply
  * @return an instance of reply processor if requireAck is true on which the caller can wait until
  *     the event has finished.
  */
 public static ReplyProcessor21 send(
     Set recipients,
     DM dm,
     int prId,
     Map<Integer, BucketAdvisor.BucketProfile> profiles,
     boolean requireAck) {
   if (recipients.isEmpty()) {
     return null;
   }
   ReplyProcessor21 rp = null;
   int procId = 0;
   if (requireAck) {
     rp = new ReplyProcessor21(dm, recipients);
     procId = rp.getProcessorId();
   }
   AllBucketProfilesUpdateMessage m =
       new AllBucketProfilesUpdateMessage(recipients, prId, procId, profiles);
   dm.putOutgoing(m);
   return rp;
 }
コード例 #5
0
 /**
  * Send profile to the provided members
  *
  * @param recips The recipients of the message
  * @throws InterruptedException
  * @throws ReplyException
  */
 public static void send(
     final DM dm, Set<InternalDistributedMember> recips, JmxManagerProfile profile) {
   JmxManagerProfileMessage r = new JmxManagerProfileMessage(recips, profile);
   dm.putOutgoing(r);
 }