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

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

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

Operators.setOnce介绍

[英]Sets the given subscription once and returns true if successful, false if the field has a subscription already or has been cancelled.

If the field already has a subscription, it is cancelled and the duplicate subscription is reported (see #reportSubscriptionSet()).
[中]设置给定的订阅一次,如果成功,则返回true;如果该字段已订阅或已取消订阅,则返回false。
如果该字段已经有订阅,则会取消订阅并报告重复订阅(请参阅#reportSubscriptionSet()。

代码示例

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

@Override
public void onSubscribe(Subscription s) {
  if (Operators.setOnce(SUBSCRIPTION, this, s)) {
    subscription.request(Long.MAX_VALUE);
  }
}

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

@Override
public void onSubscribe(Subscription s) {
  if (Operators.setOnce(S, this, s)) {
    s.request(Long.MAX_VALUE);
  }
}

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

@Override
public void onSubscribe(Subscription s) {
  if (Operators.setOnce(S, this, s)) {
    s.request(Long.MAX_VALUE);
  }
}

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

@Override
public void onSubscribe(Subscription s) {
  if (Operators.setOnce(S, this, s)) {
    s.request(prefetch);
  }
}

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

@Override
public void onSubscribe(Subscription s) {
  if (Operators.setOnce(SUBSCRIPTION, this, s)) {
    subscription.request(Long.MAX_VALUE);
  }
}

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

@Override
public void onSubscribe(Subscription s) {
  if (Operators.setOnce(S, this, s)) {
    s.request(Long.MAX_VALUE);
  }
}

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

@Override
public void onSubscribe(Subscription s) {
  if (Operators.setOnce(S, this, s)) {
    s.request(Long.MAX_VALUE);
  }
}

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

@Override
public void onSubscribe(Subscription s) {
  if (Operators.setOnce(S, this, s)) {
    s.request(Long.MAX_VALUE);
  }
}

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

@Override
public void onSubscribe(Subscription s) {
  if (Operators.setOnce(SUB, this, s)) {
    s.request(Long.MAX_VALUE);
  }
}

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

@Override
public void onSubscribe(Subscription s) {
  if (Operators.setOnce(S, this, s)) {
    s.request(Long.MAX_VALUE);
  }
}

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

@Override
public void onSubscribe(Subscription s) {
  if (Operators.setOnce(SUBSCRIPTION, this, s)) {
    subscription.request(Long.MAX_VALUE);
  }
}

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

@Override
public void onSubscribe(Subscription s) {
  if (Operators.setOnce(S, this, s)) {
    s.request(Operators.unboundedOrPrefetch(batchSize));
  }
}

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

@Override
public void onSubscribe(Subscription s) {
  if (Operators.setOnce(S, this, s)) {
    s.request(Long.MAX_VALUE);
  }
  else {
    s.cancel();
  }
}

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

@Override
public void onSubscribe(Subscription s) {
  if (Operators.setOnce(S, this, s)) {
    s.request(Operators.unboundedOrPrefetch(prefetch));
  }
}

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

@Override
public void onSubscribe(Subscription s) {
  if (Operators.setOnce(S, this, s)) {
    s.request(Long.MAX_VALUE);
  } else {
    s.cancel();
  }
}

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

void onSubscribeInner(Subscription s) {
  if (Operators.setOnce(INNER, this, s)) {
    long r = REQUESTED.getAndSet(this, 0L);
    if (r != 0) {
      s.request(r);
    }
  }
}

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

@Override
public void onSubscribe(Subscription s) {
  if (Operators.setOnce(S, this, s)) {
    s.request(Long.MAX_VALUE);
  }
  else {
    s.cancel();
  }
}

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

@Override
public void onSubscribe(Subscription s) {
  if(buffer.isDone()){
    s.cancel();
  }
  else if (Operators.setOnce(S, this, s)) {
    s.request(Long.MAX_VALUE);
  }
}

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

@Override
public void onSubscribe(Subscription s) {
  if (Operators.setOnce(S, this, s)) {
    long r = REQUESTED.getAndSet(this, 0L);
    if (r != 0L) {
      trySchedule(r, s);
    }
  }
}

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

@Override
public final void onSubscribe(Subscription s) {
  if (Operators.setOnce(S, this, s)) {
    try {
      hookOnSubscribe(s);
    }
    catch (Throwable throwable) {
      onError(Operators.onOperatorError(s, throwable, currentContext()));
    }
  }
}

相关文章