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

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

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

Operators.onNextPollError介绍

[英]Find the OnNextFailureStrategy to apply to the calling async operator (which could be a local error mode defined in the Context) and apply it.

Returns a RuntimeException if errors are fatal for the error mode, in which case the operator poll should throw the returned error. On the contrary if the error mode allows the sequence to continue, returns null in which case the operator should retry the Queue#poll().
[中]找到要应用于调用异步运算符(可能是上下文中定义的本地错误模式)的OnExtFailureStrategy并应用它。
如果错误对于错误模式是致命的,则返回RuntimeException,在这种情况下,操作员轮询应该抛出返回的错误。相反,如果错误模式允许序列继续,则返回null,在这种情况下,操作员应重试队列#poll()。

代码示例

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

@Override
@Nullable
public R poll() {
  for(;;) {
    T v = s.poll();
    if (v != null) {
      try {
        return Objects.requireNonNull(mapper.apply(v));
      }
      catch (Throwable t) {
        RuntimeException e_ = Operators.onNextPollError(v, t, currentContext());
        if (e_ != null) {
          throw e_;
        }
        else {
          continue;
        }
      }
    }
    return null;
  }
}

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

@Override
@Nullable
public R poll() {
  for(;;) {
    T v = s.poll();
    if (v != null) {
      try {
        return Objects.requireNonNull(mapper.apply(v));
      }
      catch (Throwable t) {
        RuntimeException e_ = Operators.onNextPollError(v, t, currentContext());
        if (e_ != null) {
          throw e_;
        }
        else {
          continue;
        }
      }
    }
    return null;
  }
}

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

RuntimeException e_ = Operators.onNextPollError(v, e, this.ctx);
Operators.onDiscard(v, this.ctx);
if (e_ != null) {
RuntimeException e_ = Operators.onNextPollError(v, e, this.ctx);
Operators.onDiscard(v, this.ctx);
if (e_ != null) {

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

RuntimeException e_ = Operators.onNextPollError(v, e, currentContext());
Operators.onDiscard(v, this.ctx);
if (e_ != null) {
RuntimeException e_ = Operators.onNextPollError(v, e, currentContext());
Operators.onDiscard(v, this.ctx);
if (e_ != null) {

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

@Test
public void pollErrorModeLocalStrategy() {
  List<Object> nextDropped = new ArrayList<>();
  List<Object> errorDropped = new ArrayList<>();
  Hooks.onNextDropped(nextDropped::add);
  Hooks.onErrorDropped(errorDropped::add);
  Context c = Context.of(OnNextFailureStrategy.KEY_ON_NEXT_ERROR_STRATEGY, OnNextFailureStrategy.RESUME_DROP);
  Exception error = new IllegalStateException("boom");
  try {
    assertThat(Hooks.onNextErrorHook).as("no global hook").isNull();
    RuntimeException e = Operators.onNextPollError("foo", error, c);
    assertThat(e).isNull();
    assertThat(nextDropped).containsExactly("foo");
    assertThat(errorDropped).containsExactly(error);
  }
  finally {
    Hooks.resetOnNextDropped();
    Hooks.resetOnErrorDropped();
  }
}

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

Throwable e_ = Operators.onNextPollError(v, error, actual.currentContext());
  if (e_ != null) {
    throw Exceptions.propagate(e_);
if (stop) {
  if (error != null) {
    Throwable e_ = Operators.onNextPollError(v, error, actual.currentContext());
    if (e_ != null) {
      done = true; //set done because we throw or go through `actual` directly
  Throwable e_ = Operators.onNextPollError(v, error, actual.currentContext());
  if (e_ != null) {
    throw Exceptions.propagate(e_);
if (stop) {
  if (error != null) {
    Throwable e_ = Operators.onNextPollError(v, error, actual.currentContext());
    if (e_ != null) {
      done = true; //set done because we throw or go through `actual` directly

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

Context ctx = actual.currentContext();
Throwable e_ = Operators.onNextPollError(t, e, ctx);
if (e_ == null) {
  return;

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

Throwable e_ = Operators.onNextPollError(v, error, actual.currentContext());
if (e_ != null) {
  throw Exceptions.propagate(e_);
Throwable e_ = Operators.onNextPollError(v, error, actual.currentContext());
if (e_ != null) {
  throw Exceptions.propagate(e_);
done = true; //set done because we throw or go through `actual` directly
if (error != null) {
  Throwable e_ = Operators.onNextPollError(v, error, actual.currentContext());
  if (e_ != null) {
    throw Exceptions.propagate(e_);

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

Throwable e_ = Operators.onNextPollError(v, e,
    this.ctx);
if (e_ == null) {

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

@Override
@Nullable
public R poll() {
  for(;;) {
    T v = s.poll();
    if (v != null) {
      try {
        return Objects.requireNonNull(mapper.apply(v));
      }
      catch (Throwable t) {
        RuntimeException e_ = Operators.onNextPollError(v, t, currentContext());
        if (e_ != null) {
          throw e_;
        }
        else {
          continue;
        }
      }
    }
    return null;
  }
}

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

@Override
@Nullable
public R poll() {
  for(;;) {
    T v = s.poll();
    if (v != null) {
      try {
        return Objects.requireNonNull(mapper.apply(v));
      }
      catch (Throwable t) {
        RuntimeException e_ = Operators.onNextPollError(v, t, currentContext());
        if (e_ != null) {
          throw e_;
        }
        else {
          continue;
        }
      }
    }
    return null;
  }
}

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

RuntimeException e_ = Operators.onNextPollError(v, e, this.ctx);
Operators.onDiscard(v, this.ctx);
if (e_ != null) {
RuntimeException e_ = Operators.onNextPollError(v, e, this.ctx);
Operators.onDiscard(v, this.ctx);
if (e_ != null) {

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

RuntimeException e_ = Operators.onNextPollError(v, e, currentContext());
Operators.onDiscard(v, this.ctx);
if (e_ != null) {
RuntimeException e_ = Operators.onNextPollError(v, e, currentContext());
Operators.onDiscard(v, this.ctx);
if (e_ != null) {

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

Throwable e_ = Operators.onNextPollError(v, error, actual.currentContext());
  if (e_ != null) {
    throw Exceptions.propagate(e_);
if (stop) {
  if (error != null) {
    Throwable e_ = Operators.onNextPollError(v, error, actual.currentContext());
    if (e_ != null) {
      done = true; //set done because we throw or go through `actual` directly
  Throwable e_ = Operators.onNextPollError(v, error, actual.currentContext());
  if (e_ != null) {
    throw Exceptions.propagate(e_);
if (stop) {
  if (error != null) {
    Throwable e_ = Operators.onNextPollError(v, error, actual.currentContext());
    if (e_ != null) {
      done = true; //set done because we throw or go through `actual` directly

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

Throwable e_ = Operators.onNextPollError(v, error, actual.currentContext());
if (e_ != null) {
  throw Exceptions.propagate(e_);
Throwable e_ = Operators.onNextPollError(v, error, actual.currentContext());
if (e_ != null) {
  throw Exceptions.propagate(e_);
done = true; //set done because we throw or go through `actual` directly
if (error != null) {
  Throwable e_ = Operators.onNextPollError(v, error, actual.currentContext());
  if (e_ != null) {
    throw Exceptions.propagate(e_);

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

Context ctx = actual.currentContext();
Throwable e_ = Operators.onNextPollError(t, e, ctx);
if (e_ == null) {
  return;

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

Throwable e_ = Operators.onNextPollError(v, e,
    this.ctx);
if (e_ == null) {

相关文章