Skip to content

Commit

Permalink
2.x: improve Flowable.timeout() (#5661)
Browse files Browse the repository at this point in the history
* 2.x: improve Flowable.timeout()

* Remove the now unused FullArbiter(Subscriber)

* Don't read the volatile twice
  • Loading branch information
akarnokd authored Oct 13, 2017
1 parent bffc7f2 commit 5387e20
Show file tree
Hide file tree
Showing 9 changed files with 692 additions and 748 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

232 changes: 0 additions & 232 deletions src/main/java/io/reactivex/internal/subscriptions/FullArbiter.java

This file was deleted.

6 changes: 3 additions & 3 deletions src/main/java/io/reactivex/schedulers/TestScheduler.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ public void triggerActions() {
}

private void triggerActions(long targetTimeInNanoseconds) {
while (!queue.isEmpty()) {
for (;;) {
TimedRunnable current = queue.peek();
if (current.time > targetTimeInNanoseconds) {
if (current == null || current.time > targetTimeInNanoseconds) {
break;
}
// if scheduled time is 0 (immediate) use current virtual time
time = current.time == 0 ? time : current.time;
queue.remove();
queue.remove(current);

// Only execute if not unsubscribed
if (!current.scheduler.disposed) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/io/reactivex/flowable/FlowableNullTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -2328,7 +2328,7 @@ public void timeoutFirstItemNull() {

@Test(expected = NullPointerException.class)
public void timeoutFirstItemReturnsNull() {
just1.timeout(just1, new Function<Integer, Publisher<Object>>() {
just1.timeout(Flowable.never(), new Function<Integer, Publisher<Object>>() {
@Override
public Publisher<Object> apply(Integer v) {
return null;
Expand Down
Loading

0 comments on commit 5387e20

Please sign in to comment.