Interface StreamerCancellation

All Known Subinterfaces:
DisposableStreamerCancellation
All Known Implementing Classes:
CompositeDisposable

public interface StreamerCancellation
Represents non-disposable view of a DisposableStreamerCancellation that allows synchronous testing for disposed state as well as allow adding and removing Disposable resources to be cleaned up when the full container is disposed.

This view is provided to prevent calling Disposable.dispose() in Streamable.stream(StreamerCancellation) implementations because disposing a stream is the privilege of the caller/downstream.

Use the derive() to create a sub-container with full disposability access.

This interface doesn't support DisposableContainer.reset() nor DisposableContainer.clear() because it would allow accidentally removing another operator's added/registered Disposables.

Since:
4.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Adds a disposable to this container or disposes it if the container has been disposed.
    boolean
    Removes but does not dispose the given disposable if it is part of this container.
    Create a derived sub-cancellation management interface that can get disposed by this cancellation management object but disposing the sub-cancellation manager does not dispose this current StreamerCancellation instance..
    boolean
    Returns true if this resource has been disposed.
    boolean
    Removes and disposes the given disposable if it is part of this container.
  • Method Details

    • isDisposed

      boolean isDisposed()
      Returns true if this resource has been disposed.
      Returns:
      true if this resource has been disposed
    • add

      boolean add(@NonNull @NonNull Disposable d)
      Adds a disposable to this container or disposes it if the container has been disposed.
      Parameters:
      d - the disposable to add, not null
      Returns:
      true if successful, false if this container has been disposed
    • remove

      boolean remove(@NonNull @NonNull Disposable d)
      Removes and disposes the given disposable if it is part of this container.
      Parameters:
      d - the disposable to remove and dispose, not null
      Returns:
      true if the operation was successful
    • delete

      boolean delete(@NonNull @NonNull Disposable d)
      Removes but does not dispose the given disposable if it is part of this container.
      Parameters:
      d - the disposable to remove, not null
      Returns:
      true if the operation was successful
    • derive

      Create a derived sub-cancellation management interface that can get disposed by this cancellation management object but disposing the sub-cancellation manager does not dispose this current StreamerCancellation instance..
      Returns:
      the derived sub-cancellation management object