Interface FlowableAsyncEmitter<T>

  • Type Parameters:
    T - the value type of the items emitted via Emitter.onNext(Object).
    All Superinterfaces:
    Emitter<T>

    public interface FlowableAsyncEmitter<T>
    extends Emitter<T>
    Provides an API on top of the Emitter signals that allow setting and replacing a Cancellable resource to be cancelled when the associated flow is cancelled.
    Since:
    2.1.11 - experimental
    • Method Detail

      • setCancellable

        boolean setCancellable​(Cancellable c)
        Sets the current Cancellable resource to the provided one and cancels the previous one if present.

        If the underlying flow has been cancelled, the Cancellable provided will be cancelled immediately before returning false.

        Parameters:
        c - the new Cancellable to set
        Returns:
        if true, the operation was successful, if false, the associated flow has been cancelled
      • replaceCancellable

        boolean replaceCancellable​(Cancellable c)
        Sets the current Cancellable resource to the provided one.

        If the underlying flow has been cancelled, the Cancellable provided will be cancelled immediately before returning false.

        Unlike setCancellable(Cancellable), the previous Cancellable is not cancelled when returning false.

        Parameters:
        c - the new Cancellable to set
        Returns:
        if true, the operation was successful, if false, the associated flow has been cancelled
      • isCancelled

        boolean isCancelled()
        Returns true if the associated flow has been cancelled.
        Returns:
        true if the associated flow has been cancelled
      • onNothing

        void onNothing()
        The async logic may call this method to indicate the async API invocation didn't produce any items but it hasn't ended either, therefore, the generator can perform another API invocation immediately.