Class CancellablePublisher<T>

java.lang.Object
io.smallrye.mutiny.streams.utils.CancellablePublisher<T>
All Implemented Interfaces:
org.reactivestreams.Publisher<T>

public class CancellablePublisher<T> extends Object implements org.reactivestreams.Publisher<T>
Wrapped a source publisher and make it cancellable on demand. The cancellation happens if no-one subscribed to the source publisher. This class is required for the ConcatStageFactory to enforce the reactive streams rules.
Author:
Clement Escoffier
  • Constructor Details

    • CancellablePublisher

      public CancellablePublisher(org.reactivestreams.Publisher<T> delegate)
  • Method Details

    • subscribe

      public void subscribe(org.reactivestreams.Subscriber<? super T> subscriber)
      Specified by:
      subscribe in interface org.reactivestreams.Publisher<T>
    • cancelIfNotSubscribed

      public void cancelIfNotSubscribed()