Skip to content

Commit db3e7c3

Browse files
committed
cleanup: rename waitForExistenceFilterMismatch -> getOrWaitForExistenceFilterMismatch
1 parent a4726d9 commit db3e7c3

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

firebase-firestore/src/androidTest/java/com/google/firebase/firestore/QueryTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,8 @@ public void resumingAQueryShouldUseExistenceFilterToDetectDeletes() throws Excep
10921092
existenceFilterMismatchInfo = null;
10931093
} else {
10941094
existenceFilterMismatchInfo =
1095-
existenceFilterMismatchListener.waitForExistenceFilterMismatch(/*timeoutMillis=*/ 5000);
1095+
existenceFilterMismatchListener.getOrWaitForExistenceFilterMismatch(
1096+
/*timeoutMillis=*/ 5000);
10961097
}
10971098
} finally {
10981099
existenceFilterMismatchListener.stopListening();

firebase-firestore/src/androidTest/java/com/google/firebase/firestore/remote/ExistenceFilterMismatchListener.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,24 @@ public synchronized void stopListening() {
5959
}
6060

6161
/**
62-
* Waits for an existence filter mismatch.
62+
* Returns the oldest existence filter mismatch observed, waiting if none has yet been observed.
6363
*
64-
* @param timeoutMillis the amount of time, in milliseconds, to wait for an existence filter
65-
* mismatch.
64+
* <p>The oldest existence filter mismatch observed since the most recent successful invocation of
65+
* {@link #startListening} will be returned. A subsequent invocation of this method will return
66+
* the second-oldest existence filter mismatch observed, and so on. An invocation of {@link
67+
* #stopListening} followed by another invocation of {@link #startListening} will discard any
68+
* existence filter mismatches that occurred while previously started and will start observing
69+
* afresh.
70+
*
71+
* @param timeoutMillis the maximum amount of time, in milliseconds, to wait for an existence
72+
* filter mismatch to occur.
6673
* @return information about the existence filter mismatch that occurred.
6774
* @throws InterruptedException if waiting is interrupted.
6875
* @throws IllegalStateException if this object has not been started by {@link #startListening}.
6976
* @throws IllegalArgumentException if the given timeout is less than or equal to zero.
7077
*/
7178
@Nullable
72-
public ExistenceFilterMismatchInfo waitForExistenceFilterMismatch(long timeoutMillis)
79+
public ExistenceFilterMismatchInfo getOrWaitForExistenceFilterMismatch(long timeoutMillis)
7380
throws InterruptedException {
7481
if (timeoutMillis <= 0) {
7582
throw new IllegalArgumentException("invalid timeout: " + timeoutMillis);
@@ -85,7 +92,7 @@ public ExistenceFilterMismatchInfo waitForExistenceFilterMismatch(long timeoutMi
8592
"must be registered before waiting for an existence filter mismatch");
8693
}
8794

88-
return registeredListener.waitForExistenceFilterMismatch(timeoutMillis);
95+
return registeredListener.getOrWaitForExistenceFilterMismatch(timeoutMillis);
8996
}
9097

9198
private static final class TestingHooksExistenceFilterMismatchListenerImpl
@@ -102,7 +109,7 @@ public synchronized void onExistenceFilterMismatch(
102109
}
103110

104111
@Nullable
105-
synchronized ExistenceFilterMismatchInfo waitForExistenceFilterMismatch(long timeoutMillis)
112+
synchronized ExistenceFilterMismatchInfo getOrWaitForExistenceFilterMismatch(long timeoutMillis)
106113
throws InterruptedException {
107114
if (timeoutMillis <= 0) {
108115
throw new IllegalArgumentException("invalid timeout: " + timeoutMillis);

0 commit comments

Comments
 (0)