io.reactivex.Observable.blockingSubscribe()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中io.reactivex.Observable.blockingSubscribe()方法的一些代码示例,展示了Observable.blockingSubscribe()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Observable.blockingSubscribe()方法的具体详情如下:
包路径:io.reactivex.Observable
类名称:Observable
方法名:blockingSubscribe

Observable.blockingSubscribe介绍

[英]Runs the source observable to a terminal event, ignoring any values and rethrowing any exception.

Scheduler: blockingSubscribe does not operate by default on a particular Scheduler.
[中]对终端事件运行可观察的源,忽略任何值并重新引发任何异常。
调度程序:blockingSubscribe默认情况下不会在特定调度程序上运行。

代码示例

代码示例来源:origin: ReactiveX/RxJava

public void groupByKeyNull() {
  just1.groupBy(new Function<Integer, Object>() {
    @Override
    public Object apply(Integer v) {
      return null;
    }
  }).blockingSubscribe();
}

代码示例来源:origin: ReactiveX/RxJava

@Test(expected = NullPointerException.class)
public void zipWithIterableOneIsNull() {
  Observable.just(1, 2).zipWith(Arrays.asList(1, null), new BiFunction<Integer, Integer, Object>() {
    @Override
    public Object apply(Integer a, Integer b) {
      return 1;
    }
  }).blockingSubscribe();
}

代码示例来源:origin: ReactiveX/RxJava

@Test(expected = NullPointerException.class)
public void scanFunctionReturnsNull() {
  Observable.just(1, 1).scan(new BiFunction<Integer, Integer, Integer>() {
    @Override
    public Integer apply(Integer a, Integer b) {
      return null;
    }
  }).blockingSubscribe();
}

代码示例来源:origin: ReactiveX/RxJava

@Test(expected = NullPointerException.class)
public void bufferOpenCloseCloseReturnsNull() {
  just1.buffer(just1, new Function<Integer, Observable<Object>>() {
    @Override
    public Observable<Object> apply(Integer v) {
      return null;
    }
  }).blockingSubscribe();
}

代码示例来源:origin: ReactiveX/RxJava

@Test(expected = NullPointerException.class)
public void concatMapReturnsNull() {
  just1.concatMap(new Function<Integer, Observable<Object>>() {
    @Override
    public Observable<Object> apply(Integer v) {
      return null;
    }
  }).blockingSubscribe();
}

代码示例来源:origin: ReactiveX/RxJava

@Test(expected = NullPointerException.class)
public void replayBoundedUnitNull() {
  just1.replay(new Function<Observable<Integer>, Observable<Integer>>() {
    @Override
    public Observable<Integer> apply(Observable<Integer> v) {
      return v;
    }
  }, 1, 1, null).blockingSubscribe();
}

代码示例来源:origin: ReactiveX/RxJava

@Test(expected = NullPointerException.class)
public void replayBoundedSchedulerNull() {
  just1.replay(new Function<Observable<Integer>, Observable<Integer>>() {
    @Override
    public Observable<Integer> apply(Observable<Integer> v) {
      return v;
    }
  }, 1, 1, TimeUnit.SECONDS, null).blockingSubscribe();
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void interrupt() {
  TestObserver<Object> to = new TestObserver<Object>();
  Thread.currentThread().interrupt();
  Observable.never().blockingSubscribe(to);
}

代码示例来源:origin: ReactiveX/RxJava

@Test(expected = NullPointerException.class)
public void bufferSupplierReturnsNull() {
  just1.buffer(1, 1, new Callable<Collection<Integer>>() {
    @Override
    public Collection<Integer> call() {
      return null;
    }
  }).blockingSubscribe();
}

代码示例来源:origin: ReactiveX/RxJava

@Test(expected = NullPointerException.class)
public void delayWithFunctionReturnsNull() {
  just1.delay(new Function<Integer, Observable<Object>>() {
    @Override
    public Observable<Object> apply(Integer v) {
      return null;
    }
  }).blockingSubscribe();
}

代码示例来源:origin: ReactiveX/RxJava

@Test(expected = NullPointerException.class)
public void flatMapFunctionReturnsNull() {
  just1.flatMap(new Function<Integer, Observable<Object>>() {
    @Override
    public Observable<Object> apply(Integer v) {
      return null;
    }
  }).blockingSubscribe();
}

代码示例来源:origin: ReactiveX/RxJava

@Test(expected = NullPointerException.class)
public void liftReturnsNull() {
  just1.lift(new ObservableOperator<Object, Integer>() {
    @Override
    public Observer<? super Integer> apply(Observer<? super Object> observer) {
      return null;
    }
  }).blockingSubscribe();
}

代码示例来源:origin: ReactiveX/RxJava

@Test(expected = NullPointerException.class)
public void repeatWhenFunctionReturnsNull() {
  just1.repeatWhen(new Function<Observable<Object>, Observable<Object>>() {
    @Override
    public Observable<Object> apply(Observable<Object> v) {
      return null;
    }
  }).blockingSubscribe();
}

代码示例来源:origin: ReactiveX/RxJava

@Test(expected = NullPointerException.class)
public void replaySelectorReturnsNull() {
  just1.replay(new Function<Observable<Integer>, Observable<Object>>() {
    @Override
    public Observable<Object> apply(Observable<Integer> o) {
      return null;
    }
  }).blockingSubscribe();
}

代码示例来源:origin: ReactiveX/RxJava

@Test(expected = NullPointerException.class)
public void delayBothInitialSupplierReturnsNull() {
  just1.delay(null, new Function<Integer, Observable<Integer>>() {
    @Override
    public Observable<Integer> apply(Integer v) {
      return just1;
    }
  }).blockingSubscribe();
}

代码示例来源:origin: ReactiveX/RxJava

@Test(expected = NullPointerException.class)
public void startWithIterableIteratorNull() {
  just1.startWith(new Iterable<Integer>() {
    @Override
    public Iterator<Integer> iterator() {
      return null;
    }
  }).blockingSubscribe();
}

代码示例来源:origin: ReactiveX/RxJava

@Test(expected = NullPointerException.class)
public void replayTimeBoundedSelectorReturnsNull() {
  just1.replay(new Function<Observable<Integer>, Observable<Object>>() {
    @Override
    public Observable<Object> apply(Observable<Integer> v) {
      return null;
    }
  }, 1, TimeUnit.SECONDS, Schedulers.single()).blockingSubscribe();
}

代码示例来源:origin: ReactiveX/RxJava

@Test(expected = NullPointerException.class)
public void retryWhenFunctionReturnsNull() {
  Observable.error(new TestException()).retryWhen(new Function<Observable<? extends Throwable>, Observable<Object>>() {
    @Override
    public Observable<Object> apply(Observable<? extends Throwable> f) {
      return null;
    }
  }).blockingSubscribe();
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void observableBlockingSubscribe1() {
  Observable.error(new TestException())
  .blockingSubscribe(Functions.emptyConsumer());
}

代码示例来源:origin: ReactiveX/RxJava

@Test(expected = NullPointerException.class)
public void onErrorResumeNextFunctionReturnsNull() {
  Observable.error(new TestException()).onErrorResumeNext(new Function<Throwable, Observable<Object>>() {
    @Override
    public Observable<Object> apply(Throwable e) {
      return null;
    }
  }).blockingSubscribe();
}

相关文章

Observable类方法