Skip to content

Commit 882b228

Browse files
committed
Fix for Observable.toList failing with multiple subscribers
1 parent 20df6fd commit 882b228

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rxjava-core/src/main/java/rx/operators/OperationToObservableList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public static <T> Func1<Observer<List<T>>, Subscription> toObservableList(Observ
4040
private static class ToObservableList<T> implements Func1<Observer<List<T>>, Subscription> {
4141

4242
private final Observable<T> that;
43-
final ConcurrentLinkedQueue<T> list = new ConcurrentLinkedQueue<T>();
4443

4544
public ToObservableList(Observable<T> that) {
4645
this.that = that;
@@ -49,6 +48,7 @@ public ToObservableList(Observable<T> that) {
4948
public Subscription call(final Observer<List<T>> observer) {
5049

5150
return that.subscribe(new Observer<T>() {
51+
final ConcurrentLinkedQueue<T> list = new ConcurrentLinkedQueue<T>();
5252
public void onNext(T value) {
5353
// onNext can be concurrently executed so list must be thread-safe
5454
list.add(value);

0 commit comments

Comments
 (0)