本文整理了Java中io.reactivex.subjects.Subject.onSubscribe()
方法的一些代码示例,展示了Subject.onSubscribe()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Subject.onSubscribe()
方法的具体详情如下:
包路径:io.reactivex.subjects.Subject
类名称:Subject
方法名:onSubscribe
暂无
代码示例来源:origin: ReactiveX/RxJava
@Override
public void run() {
s.onSubscribe(bs);
}
};
代码示例来源:origin: ReactiveX/RxJava
@Override
public void run() {
s.onSubscribe(bs);
}
};
代码示例来源:origin: ReactiveX/RxJava
@Override
public void run() {
s.onSubscribe(bs1);
}
};
代码示例来源:origin: ReactiveX/RxJava
@Override
public void run() {
s.onSubscribe(bs2);
}
};
代码示例来源:origin: ReactiveX/RxJava
d.dispose();
} else {
actual.onSubscribe(d);
emitLoop();
代码示例来源:origin: redisson/redisson
s.dispose();
} else {
actual.onSubscribe(s);
emitLoop();
代码示例来源:origin: ReactiveX/RxJava
@Test
public void normal() {
Subject<Integer> s = PublishSubject.<Integer>create().toSerialized();
TestObserver<Integer> to = s.test();
Observable.range(1, 10).subscribe(s);
to.assertResult(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
assertFalse(s.hasObservers());
s.onNext(11);
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
s.onError(new TestException());
TestHelper.assertUndeliverable(errors, 0, TestException.class);
} finally {
RxJavaPlugins.reset();
}
s.onComplete();
Disposable bs = Disposables.empty();
s.onSubscribe(bs);
assertTrue(bs.isDisposed());
}
代码示例来源:origin: com.github.akarnokd/rxjava2-extensions
@Override
public void onSubscribe(Disposable d) {
if (DisposableHelper.setOnce(upstream, d)) {
actual.onSubscribe(this);
}
}
代码示例来源:origin: akarnokd/RxJava2Extensions
@Override
public void onSubscribe(Disposable d) {
if (DisposableHelper.setOnce(upstream, d)) {
actual.onSubscribe(this);
}
}
代码示例来源:origin: akarnokd/RxJava2Interop
@Test
public void sj1ToSj2Lifecycle() {
rx.subjects.PublishSubject<Integer> ps1 = rx.subjects.PublishSubject.create();
io.reactivex.subjects.Subject<Integer> sj2 = toV2Subject(ps1);
io.reactivex.observers.TestObserver<Integer> to = sj2.test();
assertTrue(sj2.hasObservers());
assertTrue(ps1.hasObservers());
assertFalse(sj2.hasComplete());
assertFalse(sj2.hasThrowable());
assertNull(sj2.getThrowable());
Disposable d1 = Disposables.empty();
sj2.onSubscribe(d1);
assertFalse(d1.isDisposed());
sj2.onNext(1);
sj2.onNext(2);
sj2.onComplete();
sj2.onComplete();
sj2.onError(new IOException());
sj2.onNext(3);
Disposable d2 = Disposables.empty();
sj2.onSubscribe(d2);
assertFalse(d1.isDisposed());
assertTrue(d2.isDisposed());
assertFalse(sj2.hasObservers());
assertFalse(ps1.hasObservers());
assertTrue(sj2.hasComplete());
assertFalse(sj2.hasThrowable());
assertNull(sj2.getThrowable());
to.assertResult(1, 2);
}
代码示例来源:origin: akarnokd/RxJava2Extensions
@Test
public void doubleOnSubscribe() {
final Subject<Integer> rcp = Subjects.refCount(PublishSubject.<Integer>create());
Disposable bs1 = Disposables.empty();
rcp.onSubscribe(bs1);
Disposable bs2 = Disposables.empty();
rcp.onSubscribe(bs2);
assertFalse(bs1.isDisposed());
assertTrue(bs2.isDisposed());
}
内容来源于网络,如有侵权,请联系作者删除!