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 TypeMethodDescriptionbooleanAdds a disposable to this container or disposes it if the container has been disposed.booleanRemoves but does not dispose the given disposable if it is part of this container.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 currentStreamerCancellationinstance..booleanReturns true if this resource has been disposed.booleanRemoves 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
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
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
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 currentStreamerCancellationinstance..- Returns:
- the derived sub-cancellation management object
-