本文整理了Java中rx.Subscription
类的一些代码示例,展示了Subscription
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Subscription
类的具体详情如下:
包路径:rx.Subscription
类名称:Subscription
[英]Subscription returns from Observable#subscribe(Subscriber) to allow unsubscribing.
See the utilities in Subscriptions and the implementations in the rx.subscriptions package.
This interface is the RxJava equivalent of IDisposable in Microsoft's Rx implementation.
[中]订阅从Observable#subscribe(订阅者)返回,以允许取消订阅。
请参阅订阅中的实用程序和rx中的实现。订阅包。
该接口相当于微软Rx实现中的IDisposable。
代码示例来源:origin: PipelineAI/pipeline
public void unsubscribe() {
Subscription s = rollingDistributionSubscription.get();
if (s != null) {
s.unsubscribe();
rollingDistributionSubscription.compareAndSet(s, null);
}
}
}
代码示例来源:origin: ivacf/archi
@Override
public void destroy() {
this.context = null;
if (subscription != null && !subscription.isUnsubscribed()) subscription.unsubscribe();
}
代码示例来源:origin: PipelineAI/pipeline
final CountDownLatch latch2 = new CountDownLatch(1);
final AtomicReference<String> value1 = new AtomicReference<String>(null);
final AtomicReference<String> value2 = new AtomicReference<String>(null);
s1.unsubscribe();
s2.unsubscribe();
代码示例来源:origin: PipelineAI/pipeline
@Override
public void markSuccess() {
if (status.compareAndSet(Status.HALF_OPEN, Status.CLOSED)) {
//This thread wins the race to close the circuit - it resets the stream to start it over from 0
metrics.resetStream();
Subscription previousSubscription = activeSubscription.get();
if (previousSubscription != null) {
previousSubscription.unsubscribe();
}
Subscription newSubscription = subscribeToStream();
activeSubscription.set(newSubscription);
circuitOpened.set(-1L);
}
}
代码示例来源:origin: PipelineAI/pipeline
@Override
public void call() {
underlyingSubscription.unsubscribe();
}
});
代码示例来源:origin: konmik/nucleus
/**
* Checks if a restartable is unsubscribed.
*
* @param restartableId id of the restartable.
* @return true if the subscription is null or unsubscribed, false otherwise.
*/
public boolean isUnsubscribed(int restartableId) {
Subscription subscription = restartableSubscriptions.get(restartableId);
return subscription == null || subscription.isUnsubscribed();
}
代码示例来源:origin: PipelineAI/pipeline
final CountDownLatch latch2 = new CountDownLatch(1);
final AtomicReference<String> value1 = new AtomicReference<String>(null);
final AtomicReference<String> value2 = new AtomicReference<String>(null);
s1.unsubscribe();
s2.unsubscribe();
代码示例来源:origin: PipelineAI/pipeline
@Override
public void call() {
underlyingSubscription.unsubscribe();
}
});
代码示例来源:origin: konmik/nucleus
/**
* {@inheritDoc}
*/
@CallSuper
@Override
protected void onSave(Bundle state) {
for (int i = requested.size() - 1; i >= 0; i--) {
int restartableId = requested.get(i);
Subscription subscription = restartableSubscriptions.get(restartableId);
if (subscription != null && subscription.isUnsubscribed())
requested.remove(i);
}
state.putIntegerArrayList(REQUESTED_KEY, requested);
}
代码示例来源:origin: PipelineAI/pipeline
final CountDownLatch latch2 = new CountDownLatch(1);
final AtomicReference<String> value1 = new AtomicReference<String>(null);
final AtomicReference<String> value2 = new AtomicReference<String>(null);
s1.unsubscribe();
代码示例来源:origin: PipelineAI/pipeline
public void unsubscribe() {
Subscription s = rollingMaxSubscription.get();
if (s != null) {
s.unsubscribe();
rollingMaxSubscription.compareAndSet(s, null);
}
}
}
代码示例来源:origin: PipelineAI/pipeline
@Override
public void call() {
sourceSubscription.unsubscribe();
}
});
代码示例来源:origin: ivacf/archi
@Override
public void destroy() {
if (subscription != null && !subscription.isUnsubscribed()) subscription.unsubscribe();
subscription = null;
context = null;
dataListener = null;
}
代码示例来源:origin: konmik/nucleus
@Test
public void testCompletedRestartable() throws Exception {
Func0<Subscription> restartable = mock(Func0.class);
Subscription subscription = mock(Subscription.class);
RxPresenter presenter = new RxPresenter();
presenter.create(null);
when(restartable.call()).thenReturn(subscription);
when(subscription.isUnsubscribed()).thenReturn(true);
presenter.restartable(1, restartable);
verifyNoMoreInteractions(restartable);
presenter.start(1);
}
代码示例来源:origin: PipelineAI/pipeline
final CountDownLatch latch2 = new CountDownLatch(1);
final AtomicReference<String> value1 = new AtomicReference<String>(null);
final AtomicReference<String> value2 = new AtomicReference<String>(null);
s1.unsubscribe();
代码示例来源:origin: PipelineAI/pipeline
public void unsubscribe() {
Subscription s = subscription.get();
if (s != null) {
s.unsubscribe();
subscription.compareAndSet(s, null);
}
}
}
代码示例来源:origin: PipelineAI/pipeline
public void unsubscribe() {
originalSubscription.unsubscribe();
}
}
代码示例来源:origin: cymcsg/UltimateAndroid
public static void unsubscribeIfNotNull(Subscription subscription) {
if (subscription != null && !subscription.isUnsubscribed()) {
subscription.unsubscribe();
}
}
}
代码示例来源:origin: konmik/nucleus
@Test
public void testRestartableIsUnsubscribed() throws Exception {
RxPresenter presenter = new RxPresenter();
presenter.create(null);
Func0<Subscription> restartable = mock(Func0.class);
Subscription subscription = mock(Subscription.class);
when(restartable.call()).thenReturn(subscription);
when(subscription.isUnsubscribed()).thenReturn(false);
presenter.restartable(1, restartable);
assertTrue(presenter.isUnsubscribed(1));
}
代码示例来源:origin: PipelineAI/pipeline
final CountDownLatch latch2 = new CountDownLatch(1);
final AtomicReference<String> value1 = new AtomicReference<String>(null);
final AtomicReference<String> value2 = new AtomicReference<String>(null);
s2.unsubscribe();
内容来源于网络,如有侵权,请联系作者删除!