87
87
import rx .operators .OperationTakeWhile ;
88
88
import rx .operators .OperationThrottleFirst ;
89
89
import rx .operators .OperationTimeInterval ;
90
- import rx .operators .OperationTimeout ;
91
90
import rx .operators .OperationTimer ;
92
91
import rx .operators .OperationToMap ;
93
92
import rx .operators .OperationToMultimap ;
106
105
import rx .operators .OperatorRepeat ;
107
106
import rx .operators .OperatorSubscribeOn ;
108
107
import rx .operators .OperatorTake ;
108
+ import rx .operators .OperatorTimeout ;
109
+ import rx .operators .OperatorTimeoutWithSelector ;
109
110
import rx .operators .OperatorTimestamp ;
110
111
import rx .operators .OperatorToObservableList ;
111
112
import rx .operators .OperatorToObservableSortedList ;
@@ -7755,11 +7756,8 @@ public final Observable<TimeInterval<T>> timeInterval(Scheduler scheduler) {
7755
7756
* @return an Observable that completes if either the first item or any subsequent item doesn't
7756
7757
* arrive within the time windows specified by the timeout selectors
7757
7758
*/
7758
- public final <U , V > Observable <T > timeout (Func0 <? extends Observable <U >> firstTimeoutSelector , Func1 <? super T , ? extends Observable <U >> timeoutSelector ) {
7759
- if (firstTimeoutSelector == null ) {
7760
- throw new NullPointerException ("firstTimeoutSelector" );
7761
- }
7762
- return timeout (firstTimeoutSelector , timeoutSelector , Observable .<T > empty ());
7759
+ public final <U , V > Observable <T > timeout (Func0 <? extends Observable <U >> firstTimeoutSelector , Func1 <? super T , ? extends Observable <V >> timeoutSelector ) {
7760
+ return timeout (firstTimeoutSelector , timeoutSelector , null );
7763
7761
}
7764
7762
7765
7763
/**
@@ -7785,14 +7783,11 @@ public final <U, V> Observable<T> timeout(Func0<? extends Observable<U>> firstTi
7785
7783
* @return an Observable that mirrors the source Observable, but switches to the {@code other} Observable if either the first item emitted by the source Observable or any
7786
7784
* subsequent item don't arrive within time windows defined by the timeout selectors
7787
7785
*/
7788
- public final <U , V > Observable <T > timeout (Func0 <? extends Observable <U >> firstTimeoutSelector , Func1 <? super T , ? extends Observable <U >> timeoutSelector , Observable <? extends T > other ) {
7789
- if (firstTimeoutSelector == null ) {
7790
- throw new NullPointerException ("firstTimeoutSelector" );
7791
- }
7792
- if (other == null ) {
7793
- throw new NullPointerException ("other" );
7786
+ public final <U , V > Observable <T > timeout (Func0 <? extends Observable <U >> firstTimeoutSelector , Func1 <? super T , ? extends Observable <V >> timeoutSelector , Observable <? extends T > other ) {
7787
+ if (timeoutSelector == null ) {
7788
+ throw new NullPointerException ("timeoutSelector is null" );
7794
7789
}
7795
- return create ( OperationTimeout . timeoutSelector ( this , firstTimeoutSelector , timeoutSelector , other ));
7790
+ return lift ( new OperatorTimeoutWithSelector < T , U , V >( firstTimeoutSelector , timeoutSelector , other ));
7796
7791
}
7797
7792
7798
7793
/**
@@ -7814,8 +7809,8 @@ public final <U, V> Observable<T> timeout(Func0<? extends Observable<U>> firstTi
7814
7809
* the source Observable takes longer to arrive than the time window defined by the
7815
7810
* selector for the previously emitted item
7816
7811
*/
7817
- public final <U > Observable <T > timeout (Func1 <? super T , ? extends Observable <U >> timeoutSelector ) {
7818
- return timeout (timeoutSelector , Observable .< T > empty () );
7812
+ public final <V > Observable <T > timeout (Func1 <? super T , ? extends Observable <V >> timeoutSelector ) {
7813
+ return timeout (null , timeoutSelector , null );
7819
7814
}
7820
7815
7821
7816
/**
@@ -7839,11 +7834,8 @@ public final <U> Observable<T> timeout(Func1<? super T, ? extends Observable<U>>
7839
7834
* fallback Observable if a item emitted by the source Observable takes longer to arrive
7840
7835
* than the time window defined by the selector for the previously emitted item
7841
7836
*/
7842
- public final <U > Observable <T > timeout (Func1 <? super T , ? extends Observable <U >> timeoutSelector , Observable <? extends T > other ) {
7843
- if (other == null ) {
7844
- throw new NullPointerException ("other" );
7845
- }
7846
- return create (OperationTimeout .timeoutSelector (this , null , timeoutSelector , other ));
7837
+ public final <V > Observable <T > timeout (Func1 <? super T , ? extends Observable <V >> timeoutSelector , Observable <? extends T > other ) {
7838
+ return timeout (null , timeoutSelector , other );
7847
7839
}
7848
7840
7849
7841
/**
@@ -7864,7 +7856,7 @@ public final <U> Observable<T> timeout(Func1<? super T, ? extends Observable<U>>
7864
7856
* @see <a href="http://msdn.microsoft.com/en-us/library/hh244283.aspx">MSDN: Observable.Timeout</a>
7865
7857
*/
7866
7858
public final Observable <T > timeout (long timeout , TimeUnit timeUnit ) {
7867
- return create ( OperationTimeout . timeout (this , timeout , timeUnit ));
7859
+ return timeout (timeout , timeUnit , null , Schedulers . computation ( ));
7868
7860
}
7869
7861
7870
7862
/**
@@ -7887,7 +7879,7 @@ public final Observable<T> timeout(long timeout, TimeUnit timeUnit) {
7887
7879
* @see <a href="http://msdn.microsoft.com/en-us/library/hh229512.aspx">MSDN: Observable.Timeout</a>
7888
7880
*/
7889
7881
public final Observable <T > timeout (long timeout , TimeUnit timeUnit , Observable <? extends T > other ) {
7890
- return create ( OperationTimeout . timeout (this , timeout , timeUnit , other ));
7882
+ return timeout (timeout , timeUnit , other , Schedulers . computation ( ));
7891
7883
}
7892
7884
7893
7885
/**
@@ -7912,7 +7904,7 @@ public final Observable<T> timeout(long timeout, TimeUnit timeUnit, Observable<?
7912
7904
* @see <a href="http://msdn.microsoft.com/en-us/library/hh211676.aspx">MSDN: Observable.Timeout</a>
7913
7905
*/
7914
7906
public final Observable <T > timeout (long timeout , TimeUnit timeUnit , Observable <? extends T > other , Scheduler scheduler ) {
7915
- return create ( OperationTimeout . timeout ( this , timeout , timeUnit , other , scheduler ));
7907
+ return lift ( new OperatorTimeout < T >( timeout , timeUnit , other , scheduler ));
7916
7908
}
7917
7909
7918
7910
/**
@@ -7935,7 +7927,7 @@ public final Observable<T> timeout(long timeout, TimeUnit timeUnit, Observable<?
7935
7927
* @see <a href="http://msdn.microsoft.com/en-us/library/hh228946.aspx">MSDN: Observable.Timeout</a>
7936
7928
*/
7937
7929
public final Observable <T > timeout (long timeout , TimeUnit timeUnit , Scheduler scheduler ) {
7938
- return create ( OperationTimeout . timeout (this , timeout , timeUnit , scheduler ) );
7930
+ return timeout (timeout , timeUnit , null , scheduler );
7939
7931
}
7940
7932
7941
7933
/**
0 commit comments