File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
rxjava-core/src/main/java/rx Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -303,6 +303,33 @@ private Subscription protectivelyWrapAndSubscribe(Observer<? super T> o) {
303
303
return subscription .wrap (subscribe (new SafeObserver <T >(subscription , o )));
304
304
}
305
305
306
+ /**
307
+ * Subscribe and ignore all events.
308
+ *
309
+ * @return
310
+ */
311
+ public Subscription subscribe () {
312
+ return protectivelyWrapAndSubscribe (new Observer <T >() {
313
+
314
+ @ Override
315
+ public void onCompleted () {
316
+ // do nothing
317
+ }
318
+
319
+ @ Override
320
+ public void onError (Throwable e ) {
321
+ handleError (e );
322
+ throw new OnErrorNotImplementedException (e );
323
+ }
324
+
325
+ @ Override
326
+ public void onNext (T args ) {
327
+ // do nothing
328
+ }
329
+
330
+ });
331
+ }
332
+
306
333
/**
307
334
* An {@link Observer} must call an Observable's {@code subscribe} method
308
335
* in order to receive items and notifications from the Observable.
You can’t perform that action at this time.
0 commit comments