org.reactivestreams.Subscription.cancel()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(114)

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

Subscription.cancel介绍

[英]Request the Publisher to stop sending data and clean up resources.

Data may still be sent to meet previously signalled demand after calling cancel.
[中]请求发布者停止发送数据并清理资源。
在调用cancel后,仍可以发送数据以满足之前发出的信号需求。

代码示例

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

@Override
public void dispose() {
  upstream.cancel();
  upstream = SubscriptionHelper.CANCELLED;
}

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

@Override
  public void cancel() {
    upstream.cancel();
  }
}

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

@Override
  public void cancel() {
    super.cancel();
    upstream.cancel();
  }
}

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

@Override
public void dispose() {
  disposed = true;
  upstream.cancel();
  set.dispose();
}

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

@Override
  public void cancel() {
    super.cancel();
    upstream.cancel();
  }
}

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

@Override
public void onNext(U value) {
  upstream.cancel();
  onComplete();
}

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

@Override
public void cancel() {
  upstream.cancel();
  runFinally();
}

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

@Override
  public void cancel() {
    upstream.cancel();
    worker.dispose();
  }
}

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

@Override
public void cancel() {
  disposeAfter();
  upstream.cancel();
}

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

@Override
  public final void cancel() {
    super.cancel();
    receiver.cancel();
  }
}

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

void innerError(Throwable e) {
  if (once.compareAndSet(false, true)) {
    upstream.cancel();
    downstream.onError(e);
  } else {
    RxJavaPlugins.onError(e);
  }
}

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

@Override
public void cancel() {
  if (!cancelled) {
    cancelled = true;
    upstream.cancel();
    if (getAndIncrement() == 0) {
      queue.clear();
    }
  }
}

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

@Override
public void cancel() {
  upstream.cancel();
  if (compareAndSet(false, true)) {
    parent.cancel(connection);
  }
}

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

@Override
public void onNext(Object value) {
  get().cancel();
  parent.otherComplete();
}

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

@Override
public void onNext(T t) {
  if (!done && remaining-- > 0) {
    boolean stop = remaining == 0;
    downstream.onNext(t);
    if (stop) {
      upstream.cancel();
      onComplete();
    }
  }
}

代码示例来源: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 onNext(Object t) {
  Subscription upstream = get();
  if (upstream != SubscriptionHelper.CANCELLED) {
    upstream.cancel();
    lazySet(SubscriptionHelper.CANCELLED);
    parent.onTimeout(idx);
  }
}

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

@Override
public void dispose() {
  disposed = true;
  upstream.cancel();
  inner.dispose();
  if (getAndIncrement() == 0) {
    queue.clear();
  }
}

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

@Override
public void cancel() {
  cancelled = true;
  upstream.cancel();
  inner.dispose();
  if (getAndIncrement() == 0) {
    queue.clear();
    item = null;
  }
}

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

@Test
public void testSingleSet() {
  AsyncSubscription as = new AsyncSubscription();
  Subscription s = mock(Subscription.class);
  as.setSubscription(s);
  Subscription s1 = mock(Subscription.class);
  as.setSubscription(s1);
  assertSame(as.actual.get(), s);
  verify(s1).cancel();
}

相关文章