本文整理了Java中org.reactivestreams.Subscription.request()
方法的一些代码示例,展示了Subscription.request()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Subscription.request()
方法的具体详情如下:
包路径:org.reactivestreams.Subscription
类名称:Subscription
方法名:request
[英]No events will be sent by a Publisher until demand is signaled via this method.
It can be called however often and whenever needed—but the outstanding cumulative demand must never exceed Long.MAX_VALUE. An outstanding cumulative demand of Long.MAX_VALUE may be treated by the Publisher as "effectively unbounded".
Whatever has been requested can be sent by the Publisher so only signal demand for what can be safely handled.
A Publisher can send less than is requested if the stream ends but then must emit either Subscriber#onError(Throwable) or Subscriber#onComplete().
[中]在通过此方法发出需求信号之前,发布者不会发送任何事件。
无论何时何地,无论何时何地,都可以调用它,但未完成的累积需求不得超过长期需求。最大值。一个突出的长期累积需求。出版商可能会将最大值视为“有效无边界”。
发布者可以发送所请求的内容,因此只有安全处理的内容才能发出信号。
如果流结束,发布者可以发送少于请求的内容,但必须发送订阅方#OneError(可丢弃)或订阅方#onComplete()。
代码示例来源:origin: ReactiveX/RxJava
@Override
public void accept(Subscription t) throws Exception {
t.request(Long.MAX_VALUE);
}
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onSubscribe(Subscription s) {
if (SubscriptionHelper.validate(this.upstream, s)) {
this.upstream = s;
downstream.onSubscribe(this);
s.request(Long.MAX_VALUE);
}
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onSubscribe(Subscription s) {
if (SubscriptionHelper.validate(this.upstream, s)) {
this.upstream = s;
downstream.onSubscribe(this);
s.request(Long.MAX_VALUE);
}
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void request(long n) {
if (SubscriptionHelper.validate(n)) {
upstream.get().request(n);
}
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onSubscribe(Subscription s) {
if (SubscriptionHelper.validate(upstream, s)) {
upstream = s;
downstream.onSubscribe(this);
s.request(prefetch);
}
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onNext(T t) {
if (!tryOnNext(t)) {
upstream.request(1);
}
}
代码示例来源:origin: ReactiveX/RxJava
public void request() {
if (sourceMode != QueueSubscription.SYNC) {
long p = produced + 1;
if (p >= limit) {
produced = 0;
get().request(p);
} else {
produced = p;
}
}
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onSubscribe(Subscription s) {
if (SubscriptionHelper.validate(this.upstream, s)) {
this.upstream = s;
downstream.onSubscribe(this);
s.request(maxConcurrency == Integer.MAX_VALUE ? Long.MAX_VALUE : maxConcurrency);
}
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onNext(T t) {
if (!tryOnNext(t) && !done) {
upstream.get().request(1);
}
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onSubscribe(Subscription s) {
if (SubscriptionHelper.validate(this.upstream, s)) {
this.upstream = s;
downstream.onSubscribe(this);
s.request(Long.MAX_VALUE);
}
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onSubscribe(Subscription s) {
if (SubscriptionHelper.validate(upstream, s)) {
upstream = s;
downstream.onSubscribe(this);
s.request(Long.MAX_VALUE);
}
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onSubscribe(Subscription t) {
t.request(-1);
t.request(1);
t.request(Long.MAX_VALUE);
t.request(Long.MAX_VALUE);
t.cancel();
t.cancel();
t.request(2);
}
});
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onSubscribe(Subscription s) {
if (SubscriptionHelper.validate(this.upstream, s)) {
this.upstream = s;
downstream.onSubscribe(this);
s.request(Long.MAX_VALUE);
}
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onSubscribe(Subscription s) {
if (SubscriptionHelper.validate(this.upstream, s)) {
this.upstream = s;
downstream.onSubscribe(this);
s.request(Long.MAX_VALUE);
}
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onSubscribe(Subscription s) {
if (SubscriptionHelper.validate(this.upstream, s)) {
this.upstream = s;
downstream.onSubscribe(this);
s.request(Long.MAX_VALUE);
}
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onSubscribe(Subscription s) {
if (SubscriptionHelper.validate(this.upstream, s)) {
this.upstream = s;
downstream.onSubscribe(this);
s.request(Long.MAX_VALUE);
}
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onSubscribe(Subscription s) {
if (SubscriptionHelper.validate(this.upstream, s)) {
this.upstream = s;
downstream.onSubscribe(this);
if (other.get() == null) {
sampler.subscribe(new SamplerSubscriber<T>(this));
s.request(Long.MAX_VALUE);
}
}
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onSubscribe(Subscription s) {
if (SubscriptionHelper.validate(this.upstream, s)) {
this.upstream = s;
downstream.onSubscribe(this);
s.request(Long.MAX_VALUE);
}
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void request(long n) {
try {
parent.onRequest.accept(n);
} catch (Throwable ex) {
Exceptions.throwIfFatal(ex);
RxJavaPlugins.onError(ex);
}
upstream.request(n);
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void request(long n) {
try {
onRequest.accept(n);
} catch (Throwable e) {
Exceptions.throwIfFatal(e);
RxJavaPlugins.onError(e);
}
upstream.request(n);
}
内容来源于网络,如有侵权,请联系作者删除!