reactor.core.publisher.Operators.error()方法的使用及代码示例

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

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

Operators.error介绍

[英]Calls onSubscribe on the target Subscriber with the empty instance followed by a call to onError with the supplied error.
[中]Calls onSubscribe在目标订阅服务器上使用空实例,然后调用onError并返回提供的错误。

代码示例

代码示例来源:origin: reactor/reactor-core

void reportError(Subscriber<?>[] subscribers, Throwable ex) {
  for (Subscriber<?> s : subscribers) {
    Operators.error(s, ex);
  }
}

代码示例来源:origin: reactor/reactor-core

void reportError(Subscriber<?>[] subscribers, Throwable ex) {
  for (Subscriber<?> s : subscribers) {
    Operators.error(s, ex);
  }
}

代码示例来源:origin: reactor/reactor-core

@Override
public void subscribe(CoreSubscriber<? super T> actual) {
  if (ONCE.compareAndSet(this, 0, 1)) {
    this.actual = actual;
    actual.onSubscribe(this);
  } else {
    Operators.error(actual, new IllegalStateException("This ParallelGroup can be subscribed to at most once."));
  }
}

代码示例来源:origin: reactor/reactor-core

@Override
public void subscribe(CoreSubscriber<? super T> actual) {
  Throwable error = Objects.requireNonNull(errorSupplier.get(), "the errorSupplier returned null");
  Operators.error(actual, Operators.onOperatorError(error, actual.currentContext()));
}

代码示例来源:origin: reactor/reactor-core

@Override
public void subscribe(CoreSubscriber<? super T> actual) {
  Throwable error = Objects.requireNonNull(errorSupplier.get(), "errorSupplier produced a null Throwable");
  Operators.error(actual, Operators.onOperatorError(error, actual.currentContext()));
}

代码示例来源:origin: reactor/reactor-core

@Override
public void subscribe(CoreSubscriber<? super T> actual) {
  Operators.error(actual, Operators.onOperatorError(error, actual.currentContext()));
}

代码示例来源:origin: reactor/reactor-core

@Override
public void subscribe(CoreSubscriber<? super T> actual) {
  Operators.error(actual, Operators.onOperatorError(error, actual.currentContext()));
}

代码示例来源:origin: reactor/reactor-core

@SuppressWarnings("unchecked")
public void subscribe(CoreSubscriber<? super T> actual) {
  Mono<? extends T> p;
  try {
    p = Objects.requireNonNull(supplier.get(),
        "The Mono returned by the supplier is null");
  }
  catch (Throwable e) {
    Operators.error(actual, Operators.onOperatorError(e, actual.currentContext()));
    return;
  }
  p.subscribe(actual);
}

代码示例来源:origin: reactor/reactor-core

@Override
public void subscribe(CoreSubscriber<? super T> actual) {
  Iterator<? extends T> it;
  try {
    it = iterable.iterator();
  }
  catch (Throwable e) {
    Operators.error(actual, Operators.onOperatorError(e, actual.currentContext()));
    return;
  }
  subscribe(actual, it, onClose);
}

代码示例来源:origin: reactor/reactor-core

@Override
public void onError(Throwable t) {
  if (main == null) {
    if (MAIN.compareAndSet(this, null, Operators.cancelledSubscription())) {
      Operators.error(actual, t);
      return;
    }
  }
  cancel();
  actual.onError(t);
}

代码示例来源:origin: reactor/reactor-core

@Override
public void subscribe(CoreSubscriber<? super T> actual) {
  try {
    run.run();
  } catch (Throwable ex) {
    Operators.error(actual, Operators.onOperatorError(ex, actual.currentContext()));
    return;
  }
  Operators.complete(actual);
}

代码示例来源:origin: reactor/reactor-core

@Override
public void subscribe(CoreSubscriber<? super C> actual) {
  C collection;
  try {
    collection = Objects.requireNonNull(collectionSupplier.get(),
        "The collectionSupplier returned a null collection");
  }
  catch (Throwable ex) {
    Operators.error(actual, Operators.onOperatorError(ex, actual.currentContext()));
    return;
  }
  source.subscribe(new MonoBufferAllSubscriber<>(actual, collection));
}

代码示例来源:origin: reactor/reactor-core

@Override
@SuppressWarnings("unchecked")
public void subscribe(CoreSubscriber<? super T> actual) {
  Publisher<? extends T> p;
  try {
    p = Objects.requireNonNull(supplier.get(),
        "The Publisher returned by the supplier is null");
  }
  catch (Throwable e) {
    Operators.error(actual, Operators.onOperatorError(e, actual.currentContext()));
    return;
  }
  from(p).subscribe(actual);
}

代码示例来源:origin: reactor/reactor-core

void otherError(Throwable t) {
  if (main == null) {
    if (MAIN.compareAndSet(this, null, Operators.cancelledSubscription())) {
      cancelMain();
      Operators.error(actual, t);
      return;
    }
  }
  cancelMain();
  otherValue = null;
  actual.onError(t);
}

代码示例来源:origin: reactor/reactor-core

@Override
public void onError(Throwable t) {
  if (main == null) {
    if (MAIN.compareAndSet(this, null, Operators.cancelledSubscription())) {
      cancelOther();
      Operators.error(actual, t);
      return;
    }
  }
  cancelOther();
  otherValue = null;
  actual.onError(t);
}

代码示例来源:origin: reactor/reactor-core

@Override
public void subscribe(CoreSubscriber<? super T> actual) {
  S state;
  try {
    state = stateSupplier.call();
  } catch (Throwable e) {
    Operators.error(actual, Operators.onOperatorError(e, actual.currentContext()));
    return;
  }
  actual.onSubscribe(new GenerateSubscription<>(actual, state, generator, stateConsumer));
}

代码示例来源:origin: reactor/reactor-core

@Override
public void subscribe(CoreSubscriber<? super T> actual) {
  Context c;
  try {
    c = doOnContext.apply(actual.currentContext());
  }
  catch (Throwable t) {
    Operators.error(actual, Operators.onOperatorError(t, actual.currentContext()));
    return;
  }
  source.subscribe(new ContextStartSubscriber<>(actual, c));
}

代码示例来源:origin: reactor/reactor-core

@Override
public void subscribe(CoreSubscriber<? super T> actual) {
  Context c;
  try {
    c = doOnContext.apply(actual.currentContext());
  }
  catch (Throwable t) {
    Operators.error(actual, Operators.onOperatorError(t, actual.currentContext()));
    return;
  }
  source.subscribe(new FluxContextStart.ContextStartSubscriber<>(actual, c));
}

代码示例来源:origin: reactor/reactor-core

@Override
public void onError(Throwable t) {
  if (MAIN.compareAndSet(this, null, Operators.cancelledSubscription())) {
      Operators.error(actual, t);
      return;
  }
  else if (main == Operators.cancelledSubscription()){
    Operators.onErrorDropped(t, actual.currentContext());
    return;
  }
  cancel();
  actual.onError(t);
}

代码示例来源:origin: reactor/reactor-core

@Override
protected List<Scenario<String, String>> scenarios_operatorError() {
  return Arrays.asList(
      scenario(f -> f.skipUntilOther(Flux.error(exception()))),
      scenario(f -> f.skipUntilOther(Flux.from(s -> {
        Operators.error(s, exception());
        //touch dropped items
        s.onNext(item(0));
        s.onNext(item(0));
        s.onComplete();
        s.onComplete();
      })))
  );
}

相关文章