Reimplement Zip Operator Using Lift [Preview]#785
Reimplement Zip Operator Using Lift [Preview]#785benjchristensen merged 4 commits intoReactiveX:masterfrom
Conversation
|
RxJava-pull-requests #704 ABORTED |
There was a problem hiding this comment.
If observer is not SafeObserver, there will be a similar issue like #766 ?
There was a problem hiding this comment.
No, because counter will stay 1 and won't let any tick() to execute after a completion condition.
|
Other than the lack of null sentinel, it looks okay. |
|
Thank you both for the review. |
There was a problem hiding this comment.
Sorry for my ambiguous comment.
Here is the test:
@SuppressWarnings("unchecked")
@Test
public void testOnErrorWithInternalObserver() {
Observable<String> w = Observable.zip(
Observable.<Integer> error(new RuntimeException()),
Observable.<Integer> error(new RuntimeException()),
new Func2<Integer,Integer,String>(){
@Override
public String call(Integer t1, Integer t2) {
return t1 + "" + t2;
}
});
final Observer<String> observer = mock(Observer.class);
w.subscribe(new Observer<String>() {
@Override
public void onCompleted() {
observer.onCompleted();
}
@Override
public void onError(Throwable e) {
observer.onError(e);
}
@Override
public void onNext(String t) {
observer.onNext(t);
}
});
verify(observer, times(1)).onError(isA(RuntimeException.class)); // The current implementation will emit 2 errors.
verify(observer, never()).onCompleted();
verify(observer, never()).onNext(any(String.class));
}There was a problem hiding this comment.
The test need to be put in the OperatorZipTest.java.
|
Is it possible to lift (2..n)-arity operator ? |
If you're referring to arguments passed into an If you're referring to something like In this particular instance I'm taking the types, creating an return just(new Observable<?>[] { o1, o2, o3 }).lift(new OperatorZip<R>(zipFunction));If the specific types wanted to be retained, then the I think of this somewhat like currying, where an |
|
RxJava-pull-requests #716 ABORTED |
- Use new lift operator implement and non-blocking synchronization approach. - I have had the concurrency model reviewed by some colleagues and all unit tests are passing but further review is justified and welcome.
Similar to Observers.
Reimplement Zip Operator Using Lift [Preview]
|
RxJava-pull-requests #732 FAILURE |
A preview of a re-implementation of the
zipoperator.This re-implements the
zipoperator but not yet thezipIterableso those unit tests are still failing. I'm submitting early to get a code review and will finish thezipIterablesometime early next week.I have already had the concurrency model reviewed by two others and all unit tests are passing but further review is justified and welcome.
The performance of this implementation (without doing any profiling) has risen from 1.42m ops/second on v0.16 to 1.67m ops/second as measured on my machine for the simple test
Observable.zip(from(1), from(1), {a, b -> a+b})and 31k ops/second to 63k ops/second forObservable.zip(range(0, 100), range(100, 200), {a, b -> a+b}).