kirklund commented on a change in pull request #6052:
URL: https://github.com/apache/geode/pull/6052#discussion_r583849886
##########
File path:
geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegionQueue.java
##########
@@ -478,6 +478,25 @@ public Object peek() {
}
}
+ public boolean isThereEventsMatching(Predicate matchingPredicate) {
+ getInitializationLock().readLock().lock();
+ try {
+ if (this.getPartitionedRegion().isDestroyed()) {
+ throw new BucketRegionQueueUnavailableException();
+ }
+ Iterator<Object> it = this.eventSeqNumDeque.iterator();
Review comment:
[comment] Another syntax to consider if you're not familiar with it:
```
for (Object o : eventSeqNumDeque) {
Object object = optimalGet(o);
```
##########
File path:
geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegionQueue.java
##########
@@ -478,6 +478,25 @@ public Object peek() {
}
}
+ public boolean isThereEventsMatching(Predicate matchingPredicate) {
Review comment:
Predicate is a parameterized:
```
public boolean isThereEventsMatching(Predicate<Object> matchingPredicate) {
```
Giving it a type (even just `Object`) will remove warnings (I'm seeing
warnings about it in IntelliJ).
In general, you should always try to avoid raw types.
##########
File path:
geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
##########
@@ -1797,6 +1816,22 @@ public static String getSenderId(String regionName) {
return regionName.substring(1, queueStringStart);
}
+ public boolean isThereEventsMatching(Object object, Predicate condition) {
Review comment:
If you know that `object` is always a `GatewaySenderEventImpl` then it
would be better to use that in the method signature:
```
public boolean isThereEventsMatching(GatewaySenderEventImpl value,
Predicate<Object> condition) {
```
...rather than casting it on the 1st line of the method.
----------------------------------------------------------------
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]