rx.subjects.Subject.share()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(88)

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

Subject.share介绍

暂无

代码示例

代码示例来源:origin: PipelineAI/pipeline

HystrixCommandStartStream(final HystrixCommandKey commandKey) {
  this.commandKey = commandKey;
  this.writeOnlySubject = new SerializedSubject<HystrixCommandExecutionStarted, HystrixCommandExecutionStarted>(PublishSubject.<HystrixCommandExecutionStarted>create());
  this.readOnlyStream = writeOnlySubject.share();
}

代码示例来源:origin: PipelineAI/pipeline

HystrixCommandCompletionStream(final HystrixCommandKey commandKey) {
  this.commandKey = commandKey;
  this.writeOnlySubject = new SerializedSubject<HystrixCommandCompletion, HystrixCommandCompletion>(PublishSubject.<HystrixCommandCompletion>create());
  this.readOnlyStream = writeOnlySubject.share();
}

代码示例来源:origin: PipelineAI/pipeline

HystrixCollapserEventStream(final HystrixCollapserKey collapserKey) {
  this.collapserKey = collapserKey;
  this.writeOnlyStream = new SerializedSubject<HystrixCollapserEvent, HystrixCollapserEvent>(PublishSubject.<HystrixCollapserEvent>create());
  this.readOnlyStream = writeOnlyStream.share();
}

代码示例来源:origin: PipelineAI/pipeline

HystrixThreadPoolCompletionStream(final HystrixThreadPoolKey threadPoolKey) {
  this.threadPoolKey = threadPoolKey;
  this.writeOnlySubject = new SerializedSubject<HystrixCommandCompletion, HystrixCommandCompletion>(PublishSubject.<HystrixCommandCompletion>create());
  this.readOnlyStream = writeOnlySubject.share();
}

代码示例来源:origin: PipelineAI/pipeline

HystrixThreadPoolStartStream(final HystrixThreadPoolKey threadPoolKey) {
  this.threadPoolKey = threadPoolKey;
  this.writeOnlySubject = new SerializedSubject<HystrixCommandExecutionStarted, HystrixCommandExecutionStarted>(PublishSubject.<HystrixCommandExecutionStarted>create());
  this.readOnlyStream = writeOnlySubject.share();
}

代码示例来源:origin: com.netflix.hystrix/hystrix-core

HystrixCollapserEventStream(final HystrixCollapserKey collapserKey) {
  this.collapserKey = collapserKey;
  this.writeOnlyStream = new SerializedSubject<HystrixCollapserEvent, HystrixCollapserEvent>(PublishSubject.<HystrixCollapserEvent>create());
  this.readOnlyStream = writeOnlyStream.share();
}

代码示例来源:origin: com.netflix.hystrix/hystrix-core

HystrixCommandStartStream(final HystrixCommandKey commandKey) {
  this.commandKey = commandKey;
  this.writeOnlySubject = new SerializedSubject<HystrixCommandExecutionStarted, HystrixCommandExecutionStarted>(PublishSubject.<HystrixCommandExecutionStarted>create());
  this.readOnlyStream = writeOnlySubject.share();
}

代码示例来源:origin: com.netflix.hystrix/hystrix-core

HystrixThreadPoolCompletionStream(final HystrixThreadPoolKey threadPoolKey) {
  this.threadPoolKey = threadPoolKey;
  this.writeOnlySubject = new SerializedSubject<HystrixCommandCompletion, HystrixCommandCompletion>(PublishSubject.<HystrixCommandCompletion>create());
  this.readOnlyStream = writeOnlySubject.share();
}

代码示例来源:origin: com.netflix.hystrix/hystrix-core

HystrixThreadPoolStartStream(final HystrixThreadPoolKey threadPoolKey) {
  this.threadPoolKey = threadPoolKey;
  this.writeOnlySubject = new SerializedSubject<HystrixCommandExecutionStarted, HystrixCommandExecutionStarted>(PublishSubject.<HystrixCommandExecutionStarted>create());
  this.readOnlyStream = writeOnlySubject.share();
}

代码示例来源:origin: com.netflix.hystrix/hystrix-core

HystrixCommandCompletionStream(final HystrixCommandKey commandKey) {
  this.commandKey = commandKey;
  this.writeOnlySubject = new SerializedSubject<HystrixCommandCompletion, HystrixCommandCompletion>(PublishSubject.<HystrixCommandCompletion>create());
  this.readOnlyStream = writeOnlySubject.share();
}

代码示例来源:origin: akarnokd/akarnokd-misc

@Test
public void test2() throws Exception {
  Subject<Long, Long> subject = PublishSubject.create();
  Observable<Long> initialObservable = subject.share()
  .map(value -> {
    System.out.println("Received value " + value);
    new Exception().printStackTrace(System.out);
    return value;
  });
  Observable<Long> timeoutObservable = initialObservable.map(value -> {
    System.out.println("Timeout received value " + value);
    return value;
  });
  TestSubscriber<Long> subscriber = new TestSubscriber<>();
  initialObservable
  .doOnUnsubscribe(() -> System.out.println("Unsubscribed"))
  .timeout(1, TimeUnit.SECONDS, timeoutObservable).subscribe(subscriber);
  subject.onNext(5L);
  Thread.sleep(1500);
  subject.onNext(10L);
  subject.onCompleted();
  subscriber.awaitTerminalEvent();
  subscriber.assertNoErrors();
  subscriber.assertValues(5L, 10L);
}

代码示例来源:origin: akarnokd/akarnokd-misc

Observable<Long> initialObservable = subject.share()
.map(value -> {
  System.out.println("Received value " + value);

相关文章