Search in sources :

Example 1 with FunctionStreamingReplyMessage

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

the class FunctionStreamingResultCollector method process.

@Override
public void process(DistributionMessage msg) {
    if (!waitingOnMember(msg.getSender())) {
        return;
    }
    this.msgsBeingProcessed.incrementAndGet();
    try {
        ReplyMessage m = (ReplyMessage) msg;
        if (m.getException() == null) {
            FunctionStreamingReplyMessage functionReplyMsg = (FunctionStreamingReplyMessage) m;
            Object result = functionReplyMsg.getResult();
            boolean isLast = false;
            synchronized (processSingleResult) {
                isLast = trackMessage(functionReplyMsg);
                this.functionResultWaiter.processData(result, isLast, msg.getSender());
            }
            if (isLast) {
                // removes from members and cause us
                super.process(msg, false);
            // to ignore future messages received from that member
            }
        } else {
            if (execution.forwardExceptions || (execution.waitOnException)) {
                // send BucketMovedException forward which will be handled by LocalResultCollectorImpl
                synchronized (processSingleResult) {
                    this.functionResultWaiter.processData(m.getException().getCause(), true, msg.getSender());
                }
            }
            super.process(msg, false);
        }
    } finally {
        this.msgsBeingProcessed.decrementAndGet();
        // check to see if decrementing msgsBeingProcessed requires signalling to
        checkIfDone();
    // proceed
    }
}
Also used : FunctionStreamingReplyMessage(org.apache.geode.internal.cache.FunctionStreamingReplyMessage) ReplyMessage(org.apache.geode.distributed.internal.ReplyMessage) FunctionStreamingReplyMessage(org.apache.geode.internal.cache.FunctionStreamingReplyMessage)

Aggregations

ReplyMessage (org.apache.geode.distributed.internal.ReplyMessage)1 FunctionStreamingReplyMessage (org.apache.geode.internal.cache.FunctionStreamingReplyMessage)1