You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// we rely on the check above looking at completed.contains to mean that NULL here represents a completed Observer
223
-
argsToCombineLatest[i++] = lastValue.get(_w);
224
-
} else {
225
-
foundData = true;
226
-
argsToCombineLatest[i++] = q.remove();
227
-
}
228
-
}
229
-
if (completed.size() == receivedValuesPerObserver.size() && !foundData) {
230
-
// all are completed and queues have run out of data, so return and don't send empty data
231
-
return;
212
+
for (CombineObserver<R, ?> _w : observers) {
213
+
argsToCombineLatest[i++] = lastValue.get(_w);
232
214
}
233
215
}
234
216
// if we did not return above from the synchronized block we can now invoke the combineLatestFunction with all of the args
@@ -245,7 +227,7 @@ public Subscription call(Observer<R> Observer) {
245
227
this.Observer = Observer;
246
228
247
229
/* start the Observers */
248
-
for (CombineObserver<R, ?> rw : receivedValuesPerObserver.keySet()) {
230
+
for (CombineObserver<R, ?> rw : observers) {
249
231
rw.startWatching();
250
232
}
251
233
@@ -263,7 +245,7 @@ private void stop() {
263
245
/* tell ourselves to stop processing onNext events */
264
246
running.set(false);
265
247
/* propogate to all Observers to unsubscribe */
266
-
for (CombineObserver<R, ?> rw : receivedValuesPerObserver.keySet()) {
248
+
for (CombineObserver<R, ?> rw : observers) {
267
249
if (rw.subscription != null) {
268
250
rw.subscription.unsubscribe();
269
251
}
@@ -290,25 +272,26 @@ public void testCombineLatestDifferentLengthObservableSequences1() {
290
272
/* simulate sending data */
291
273
// once for w1
292
274
w1.Observer.onNext("1a");
275
+
w2.Observer.onNext("2a");
276
+
w3.Observer.onNext("3a");
293
277
w1.Observer.onCompleted();
294
278
// twice for w2
295
-
w2.Observer.onNext("2a");
296
279
w2.Observer.onNext("2b");
297
280
w2.Observer.onCompleted();
298
281
// 4 times for w3
299
-
w3.Observer.onNext("3a");
300
282
w3.Observer.onNext("3b");
301
283
w3.Observer.onNext("3c");
302
284
w3.Observer.onNext("3d");
303
285
w3.Observer.onCompleted();
304
286
305
287
/* we should have been called 4 times on the Observer */
306
288
InOrderinOrder = inOrder(w);
289
+
inOrder.verify(w).onNext("1a2a3a");
307
290
inOrder.verify(w).onNext("1a2b3a");
308
291
inOrder.verify(w).onNext("1a2b3b");
309
292
inOrder.verify(w).onNext("1a2b3c");
310
293
inOrder.verify(w).onNext("1a2b3d");
311
-
294
+
inOrder.verify(w, never()).onNext(anyString());
312
295
inOrder.verify(w, times(1)).onCompleted();
313
296
}
314
297
@@ -341,17 +324,16 @@ public void testCombineLatestDifferentLengthObservableSequences2() {
341
324
342
325
/* we should have been called 1 time only on the Observer since we only combine the "latest" we don't go back and loop through others once completed */
0 commit comments