Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
package io.reactivex.internal.operators.observable;

import java.util.ArrayDeque;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicInteger;

import io.reactivex.*;
Expand Down Expand Up @@ -218,7 +217,6 @@ public void innerComplete(InnerQueuedObserver<R> inner) {
drain();
}

@SuppressWarnings("unchecked")
@Override
public void drain() {
if (getAndIncrement() != 0) {
Expand Down Expand Up @@ -276,23 +274,6 @@ public void drain() {
return;
}

if (source instanceof Callable) {
R w;

try {
w = ((Callable<R>)source).call();
} catch (Throwable ex) {
Exceptions.throwIfFatal(ex);
error.addThrowable(ex);
continue;
}

if (w != null) {
a.onNext(w);
}
continue;
}

InnerQueuedObserver<R> inner = new InnerQueuedObserver<R>(this, prefetch);

observers.offer(inner);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1175,4 +1175,22 @@ public void innerLong() {
.assertComplete()
.assertNoErrors();
}

@Test
public void oneDelayed() {
Flowable.just(1, 2, 3, 4, 5)
.concatMapEager(new Function<Integer, Flowable<Integer>>() {
@Override
public Flowable<Integer> apply(Integer i) throws Exception {
return i == 3 ? Flowable.just(i) : Flowable
.just(i)
.delay(1, TimeUnit.MILLISECONDS, Schedulers.io());
}
})
.observeOn(Schedulers.io())
.test()
.awaitDone(5, TimeUnit.SECONDS)
.assertResult(1, 2, 3, 4, 5)
;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -983,4 +983,22 @@ public ObservableSource<Object> apply(Object v) throws Exception {
}
});
}

@Test
public void oneDelayed() {
Observable.just(1, 2, 3, 4, 5)
.concatMapEager(new Function<Integer, ObservableSource<Integer>>() {
@Override
public ObservableSource<Integer> apply(Integer i) throws Exception {
return i == 3 ? Observable.just(i) : Observable
.just(i)
.delay(1, TimeUnit.MILLISECONDS, Schedulers.io());
}
})
.observeOn(Schedulers.io())
.test()
.awaitDone(5, TimeUnit.SECONDS)
.assertResult(1, 2, 3, 4, 5)
;
}
}