File tree Expand file tree Collapse file tree 2 files changed +9
-12
lines changed
test/java/rx/internal/operators Expand file tree Collapse file tree 2 files changed +9
-12
lines changed Original file line number Diff line number Diff line change 16
16
package rx .observers ;
17
17
18
18
import java .util .List ;
19
- import java .util .concurrent .CountDownLatch ;
20
- import java .util .concurrent .TimeUnit ;
19
+ import java .util .concurrent .*;
21
20
22
- import rx .Notification ;
23
- import rx .Observer ;
24
- import rx .Subscriber ;
21
+ import rx .*;
25
22
26
23
/**
27
24
* A {@code TestSubscriber} is a variety of {@link Subscriber} that you can use for unit testing, to perform
@@ -227,9 +224,11 @@ public void awaitTerminalEvent() {
227
224
* @throws RuntimeException
228
225
* if the Subscriber is interrupted before the Observable is able to complete
229
226
*/
230
- public boolean awaitTerminalEvent (long timeout , TimeUnit unit ) {
227
+ public void awaitTerminalEvent (long timeout , TimeUnit unit ) {
231
228
try {
232
- return latch .await (timeout , unit );
229
+ if (!latch .await (timeout , unit )) {
230
+ throw new RuntimeException (new TimeoutException ());
231
+ }
233
232
} catch (InterruptedException e ) {
234
233
throw new RuntimeException ("Interrupted" , e );
235
234
}
Original file line number Diff line number Diff line change @@ -730,15 +730,12 @@ public void testRetryWithBackpressureParallel() throws InterruptedException {
730
730
exec .execute (new Runnable () {
731
731
@ Override
732
732
public void run () {
733
+ final AtomicInteger nexts = new AtomicInteger ();
733
734
try {
734
- final AtomicInteger nexts = new AtomicInteger ();
735
735
Observable <String > origin = Observable .create (new FuncWithErrors (NUM_RETRIES ));
736
736
TestSubscriber <String > ts = new TestSubscriber <String >();
737
737
origin .retry ().observeOn (Schedulers .computation ()).unsafeSubscribe (ts );
738
- if (!ts .awaitTerminalEvent (2 , TimeUnit .SECONDS )) {
739
- timeouts .incrementAndGet ();
740
- System .out .println (j + " | " + cdl .getCount () + " !!! " + nexts .get ());
741
- }
738
+ ts .awaitTerminalEvent (2 , TimeUnit .SECONDS );
742
739
if (ts .getOnNextEvents ().size () != NUM_RETRIES + 2 ) {
743
740
data .incrementAndGet ();
744
741
}
@@ -750,6 +747,7 @@ public void run() {
750
747
}
751
748
} catch (Throwable t ) {
752
749
timeouts .incrementAndGet ();
750
+ System .out .println (j + " | " + cdl .getCount () + " !!! " + nexts .get ());
753
751
}
754
752
cdl .countDown ();
755
753
}
You can’t perform that action at this time.
0 commit comments