All Downloads are FREE. Search and download functionalities are using the official Maven repository.

graphql.execution.reactive.DelegatingSubscription Maven / Gradle / Ivy

There is a newer version: 230521-nf-execution
Show newest version
package graphql.execution.reactive;

import graphql.PublicApi;
import org.reactivestreams.Subscription;

import static graphql.Assert.assertNotNull;

/**
 * A simple subscription that delegates to another
 */
@PublicApi
public class DelegatingSubscription implements Subscription {
    private final Subscription upstreamSubscription;

    public DelegatingSubscription(Subscription upstreamSubscription) {
        this.upstreamSubscription = assertNotNull(upstreamSubscription);
    }

    @Override
    public void request(long n) {
        upstreamSubscription.request(n);
    }

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

    /**
     * Get instance of upstreamSubscription
     * @return {@link Subscription}
     */
    public Subscription getUpstreamSubscription() {
        return upstreamSubscription;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy