albertogpz commented on a change in pull request #6052:
URL: https://github.com/apache/geode/pull/6052#discussion_r589358966



##########
File path: 
geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderQueue.java
##########
@@ -847,7 +855,14 @@ private EventsAndLastKey 
peekEventsWithTransactionId(TransactionId transactionId
     }
   }
 
-  EventsAndLastKey getElementsMatching(Predicate condition, Predicate 
stopCondition, long lastKey) {
+  /**
+   * This method returns a list of objects that fulfill the matchingPredicate
+   * If a matching object also fulfills the endPredicate then the method
+   * stops looking for more matching objects.
+   */
+  List<KeyAndEventPair> 
getElementsMatching(Predicate<InternalGatewayQueueEvent> condition,

Review comment:
       Good catch.

##########
File path: 
geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderQueue.java
##########
@@ -862,19 +877,35 @@ EventsAndLastKey getElementsMatching(Predicate condition, 
Predicate stopConditio
         continue;
       }
 
-      if (condition.test(object)) {
-        elementsMatching.add(object);
-        peekedIds.add(currentKey);
-        extraPeekedIds.add(currentKey);
-        lastKey = currentKey;
+      if (condition.test((InternalGatewayQueueEvent) object)) {
+        elementsMatching.add(new KeyAndEventPair(currentKey, 
(GatewaySenderEventImpl) object));
 
-        if (stopCondition.test(object)) {
+        if (stopCondition.test((InternalGatewayQueueEvent) object)) {
           break;
         }
       }
     }
 
-    return new EventsAndLastKey(elementsMatching, lastKey);
+    return elementsMatching;
+  }
+
+  public boolean isThereEventsMatching(Predicate<InternalGatewayQueueEvent> 
condition) {

Review comment:
       ok




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to