Java Code Examples for io.reactivex.internal.subscriptions.SubscriptionHelper#setOnce()

The following examples show how to use io.reactivex.internal.subscriptions.SubscriptionHelper#setOnce() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LifeSubscriber.java    From rxjava-RxLife with Apache License 2.0 5 votes vote down vote up
@Override
public void onSubscribe(Subscription s) {
    if (SubscriptionHelper.setOnce(this, s)) {
        try {
            addObserver();
            downstream.onSubscribe(s);
        } catch (Throwable ex) {
            Exceptions.throwIfFatal(ex);
            s.cancel();
            onError(ex);
        }
    }
}
 
Example 2
Source File: LifeConditionalSubscriber.java    From rxjava-RxLife with Apache License 2.0 5 votes vote down vote up
@Override
public void onSubscribe(Subscription s) {
    if (SubscriptionHelper.setOnce(this, s)) {
        try {
            addObserver();
            downstream.onSubscribe(s);
        } catch (Throwable ex) {
            Exceptions.throwIfFatal(ex);
            s.cancel();
            onError(ex);
        }
    }
}
 
Example 3
Source File: MyLambdaSubscriber.java    From RxBus with Apache License 2.0 5 votes vote down vote up
@Override
public void onSubscribe(Subscription s) {
    if (SubscriptionHelper.setOnce(this, s)) {
        try {
            onSubscribe.accept(this);
        } catch (Throwable ex) {
            Exceptions.throwIfFatal(ex);
            s.cancel();
            onError(ex);
        }
    }
}
 
Example 4
Source File: FlowableMatch.java    From rxjava2-extras with Apache License 2.0 4 votes vote down vote up
@Override
public void onSubscribe(Subscription subscription) {
    if (SubscriptionHelper.setOnce(this, subscription)) {
        subscription.request(requestSize);
    }
}
 
Example 5
Source File: FlowableStringInputStream.java    From rxjava2-extras with Apache License 2.0 4 votes vote down vote up
@Override
public void onSubscribe(Subscription s) {
    if (SubscriptionHelper.setOnce(upstream, s)) {
        s.request(1);
    }
}
 
Example 6
Source File: FlowableMergeInterleave.java    From rxjava2-extras with Apache License 2.0 4 votes vote down vote up
@Override
public void onSubscribe(Subscription s) {
    SubscriptionHelper.setOnce(subscription, s);
}
 
Example 7
Source File: FlowableStringInputStream.java    From akarnokd-misc with Apache License 2.0 4 votes vote down vote up
@Override
public void onSubscribe(Subscription s) {
    if (SubscriptionHelper.setOnce(upstream, s)) {
        s.request(1);
    }
}
 
Example 8
Source File: AbstractSubscriber.java    From resilience4j with Apache License 2.0 4 votes vote down vote up
@Override
public void onSubscribe(Subscription s) {
    if (SubscriptionHelper.setOnce(subscription, s)) {
        downstreamSubscriber.onSubscribe(this);
    }
}