Top Description Inners Methods
reactor.core

public Interface Disposable

Known Direct Subinterfaces
reactor.core.Disposable.Swap, reactor.core.Disposable.Composite, reactor.core.scheduler.Scheduler, reactor.core.scheduler.Scheduler.Worker
Known Direct Implementers
reactor.core.Disposables.SimpleDisposable, reactor.core.Disposables.AlwaysDisposable, reactor.core.Disposables.NeverDisposable, reactor.core.publisher.BaseSubscriber, reactor.core.publisher.BlockingOptionalMonoSubscriber, reactor.core.publisher.BlockingSingleSubscriber, reactor.core.publisher.NextProcessor, reactor.core.publisher.FluxProcessor, reactor.core.publisher.FluxPublish.PublishSubscriber, reactor.core.publisher.FluxCreate.SinkDisposable, reactor.core.publisher.MonoProcessor, reactor.core.publisher.LambdaMonoSubscriber, reactor.core.publisher.LambdaSubscriber, reactor.core.publisher.EmitterProcessor.EmitterDisposable, reactor.core.publisher.FluxBufferPredicate.ChangedPredicate, reactor.core.publisher.FluxBufferWhen.BufferWhenOpenSubscriber, reactor.core.publisher.FluxBufferWhen.BufferWhenCloseSubscriber, reactor.core.publisher.FluxGroupJoin.LeftRightSubscriber, reactor.core.publisher.FluxGroupJoin.LeftRightEndSubscriber, reactor.core.publisher.FluxReplay.ReplaySubscriber, reactor.core.publisher.SinkManyEmitterProcessor, reactor.core.publisher.SinkManyEmitterProcessor.EmitterDisposable, reactor.core.publisher.SinkManyReplayProcessor, reactor.core.publisher.SinkManyUnicast, reactor.core.publisher.FluxWindow.WindowExactSubscriber, reactor.core.publisher.FluxWindow.WindowSkipSubscriber, reactor.core.publisher.FluxWindow.WindowOverlapSubscriber, reactor.core.publisher.FluxWindowBoundary.WindowBoundaryMain, reactor.core.publisher.FluxWindowWhen.WindowWhenOpenSubscriber, reactor.core.publisher.FluxWindowWhen.WindowWhenCloseSubscriber, reactor.core.publisher.FluxZip.ZipSingleSubscriber, reactor.core.scheduler.BoundedElasticScheduler.BoundedState, reactor.core.scheduler.ExecutorScheduler.ExecutorPlainRunnable, reactor.core.scheduler.ExecutorScheduler.ExecutorTrackedRunnable, reactor.core.scheduler.ExecutorServiceWorker, reactor.core.scheduler.InstantPeriodicWorkerTask, reactor.core.scheduler.PeriodicSchedulerTask, reactor.core.scheduler.PeriodicWorkerTask, reactor.core.scheduler.SchedulerMetricDecorator, reactor.core.scheduler.Schedulers.Snapshot, reactor.core.scheduler.SchedulerTask, reactor.core.scheduler.WorkerTask
Annotations
@FunctionalInterface
Imports
java.util.Collection, java.util.function.Supplier, reactor.util.annotation.Nullable

Indicates that a task or resource can be cancelled/disposed.

Call to the dispose method is/should be idempotent.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
Disposable.Composite

A container of Disposable that is itself Disposable.

public static interface
Disposable.Swap

A Disposable container that allows updating/replacing its inner Disposable atomically and with respect of disposing the container itself.

Method Summary

Modifier and TypeMethod and Description
public void
dispose()

Cancel or dispose the underlying task or resource.

public default boolean

Returns:

true when there's a guarantee the resource or task is disposed.
isDisposed
()

Optionally return true when the resource or task is disposed.

Method Detail

disposeback to summary
public void dispose()

Cancel or dispose the underlying task or resource.

Implementations are required to make this method idempotent.

isDisposedback to summary
public default boolean isDisposed()

Optionally return true when the resource or task is disposed.

Implementations are not required to track disposition and as such may never return true even when disposed. However, they MUST only return true when there's a guarantee the resource or task is disposed.

Returns:boolean

true when there's a guarantee the resource or task is disposed.

reactor.core back to summary

public Interface Disposable.Composite

extends Disposable
Known Direct Implementers
reactor.core.Disposables.ListCompositeDisposable, reactor.core.scheduler.EmptyCompositeDisposable

A container of Disposable that is itself Disposable. Accumulate disposables and dispose them all in one go by using dispose(). Using the add(Disposable) methods give ownership to the container, which is now responsible for disposing them. You can however retake ownership of individual elements by keeping a reference and using remove(Disposable), which puts the responsibility of disposing said elements back in your hands. Note that once disposed, the container cannot be reused and you will need a new Composite.
Author
Simon Baslé

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the disposable could be added, false otherwise.
add
(Disposable
the Disposable to add.
d
)

Add a Disposable to this container, if it is not disposed.

public default boolean

Returns:

true if the operation was successful, false if the container has been disposed
addAll
(Collection<? extends Disposable>
the collection of Disposables
ds
)

Adds the given collection of Disposables to the container or disposes them all if the container has been disposed.

public void
dispose()

Redeclares reactor.core.Disposable.dispose.

Atomically mark the container as disposed, clear it and then dispose all the previously contained Disposables.
public boolean

Returns:

true if the container has been disposed, false otherwise.
isDisposed
()

Redeclares as abstract: reactor.core.Disposable.isDisposed.

Indicates if the container has already been disposed.
public boolean

Returns:

true if the disposable was successfully deleted, false otherwise.
remove
(Disposable
the Disposable to remove.
d
)

Delete the Disposable from this container, without disposing it.

public int

Returns:

the number of currently held Disposables
size
()

Returns the number of currently held Disposables.

Method Detail

addback to summary
public boolean add(Disposable d)

Add a Disposable to this container, if it is not disposed. Otherwise d is disposed immediately.

Parameters
d:Disposable

the Disposable to add.

Returns:boolean

true if the disposable could be added, false otherwise.

addAllback to summary
public default boolean addAll(Collection<? extends Disposable> ds)

Adds the given collection of Disposables to the container or disposes them all if the container has been disposed.

Implementation Note

The default implementation is not atomic, meaning that if the container is disposed while the content of the collection is added, first elements might be effectively added. Stronger consistency is enforced by composites created via Disposables#composite() variants.

Parameters
ds:Collection<? extends Disposable>

the collection of Disposables

Returns:boolean

true if the operation was successful, false if the container has been disposed

disposeback to summary
public void dispose()

Redeclares reactor.core.Disposable.dispose.

Atomically mark the container as disposed, clear it and then dispose all the previously contained Disposables. From there on the container cannot be reused, as add(Disposable) and addAll(Collection) methods will immediately return false.

Annotations
@Override
isDisposedback to summary
public boolean isDisposed()

Redeclares as abstract: reactor.core.Disposable.isDisposed.

Indicates if the container has already been disposed.

Note that if that is the case, attempts to add new disposable to it via add(Disposable) and addAll(Collection) will be rejected.

Returns:boolean

true if the container has been disposed, false otherwise.

Annotations
@Override
removeback to summary
public boolean remove(Disposable d)

Delete the Disposable from this container, without disposing it.

It becomes the responsibility of the caller to dispose the value themselves, which they can do by a simple call to Disposable#dispose() on said value (probably guarded by a check that this method returned true, meaning the disposable was actually in the container).

Parameters
d:Disposable

the Disposable to remove.

Returns:boolean

true if the disposable was successfully deleted, false otherwise.

sizeback to summary
public int size()

Returns the number of currently held Disposables.

Returns:int

the number of currently held Disposables

reactor.core back to summary

public Interface Disposable.Swap

extends Disposable, Supplier<Disposable>
Known Direct Implementers
reactor.core.Disposables.SwapDisposable

A Disposable container that allows updating/replacing its inner Disposable atomically and with respect of disposing the container itself.
Author
Simon Baslé

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the operation succeeded, false if the container has been disposed
replace
(Disposable
the Disposable to set, may be null
next
)

Atomically set the next Disposable on this container but don't dispose the previous one (if any).

public boolean

Returns:

true if the operation succeeded, false if the container has been disposed
update
(Disposable
the Disposable to set, may be null
next
)

Atomically set the next Disposable on this container and dispose the previous one (if any).

Inherited from java.util.function.Supplier:
get
Inherited from reactor.core.Disposable:
disposeisDisposed

Method Detail

replaceback to summary
public boolean replace(Disposable next)

Atomically set the next Disposable on this container but don't dispose the previous one (if any). If the container has been disposed, fall back to disposing next.

Parameters
next:Disposable

the Disposable to set, may be null

Returns:boolean

true if the operation succeeded, false if the container has been disposed

See Also
update(Disposable)
updateback to summary
public boolean update(Disposable next)

Atomically set the next Disposable on this container and dispose the previous one (if any). If the container has been disposed, fall back to disposing next.

Parameters
next:Disposable

the Disposable to set, may be null

Returns:boolean

true if the operation succeeded, false if the container has been disposed

See Also
replace(Disposable)