Top Description Fields Constructors Methods
io.reactivex.rxjava3.internal.disposables

public final Class ArrayCompositeDisposable

extends AtomicReferenceArray<Disposable>
implements Disposable
Class Inheritance
All Implemented Interfaces
io.reactivex.rxjava3.disposables.Disposable
Imports
java.util.concurrent.atomic.AtomicReferenceArray, io.reactivex.rxjava3.disposables.Disposable

A composite disposable with a fixed number of slots.

Note that since the implementation leaks the methods of AtomicReferenceArray, one must be careful to only call setResource, replaceResource and dispose on it. All other methods may lead to undefined behavior and should be used by internal means only.

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
dispose()

Implements io.reactivex.rxjava3.disposables.Disposable.dispose.

Dispose the resource, the operation should be idempotent.
public boolean
isDisposed()

Implements io.reactivex.rxjava3.disposables.Disposable.isDisposed.

Returns true if this resource has been disposed.
public Disposable

Returns:

the old resource, can be null
replaceResource
(int
the index of the resource to replace
index
,
Disposable
the new resource
resource
)

Replaces the resource at the specified index and returns the old resource.

public boolean

Returns:

true if the resource has ben set, false if the composite has been disposed
setResource
(int
the index of the resource to set
index
,
Disposable
the new resource
resource
)

Sets the resource at the specified index and disposes the old resource.

Inherited from java.util.concurrent.atomic.AtomicReferenceArray:
accumulateAndGetcompareAndExchangecompareAndExchangeAcquirecompareAndExchangeReleasecompareAndSetgetgetAcquiregetAndAccumulategetAndSetgetAndUpdategetOpaquegetPlainlazySetlengthsetsetOpaquesetPlainsetReleasetoStringupdateAndGetweakCompareAndSetweakCompareAndSetAcquireweakCompareAndSetPlainweakCompareAndSetReleaseweakCompareAndSetVolatile

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.concurrent.atomic.AtomicReferenceArray.serialVersionUID.

Constructor Detail

ArrayCompositeDisposableback to summary
public ArrayCompositeDisposable(int capacity)

Method Detail

disposeback to summary
public void dispose()

Implements io.reactivex.rxjava3.disposables.Disposable.dispose.

Doc from io.reactivex.rxjava3.disposables.Disposable.dispose.

Dispose the resource, the operation should be idempotent.

Annotations
@Override
isDisposedback to summary
public boolean isDisposed()

Implements io.reactivex.rxjava3.disposables.Disposable.isDisposed.

Doc from io.reactivex.rxjava3.disposables.Disposable.isDisposed.

Returns true if this resource has been disposed.

Returns:boolean

true if this resource has been disposed

Annotations
@Override
replaceResourceback to summary
public Disposable replaceResource(int index, Disposable resource)

Replaces the resource at the specified index and returns the old resource.

Parameters
index:int

the index of the resource to replace

resource:Disposable

the new resource

Returns:Disposable

the old resource, can be null

setResourceback to summary
public boolean setResource(int index, Disposable resource)

Sets the resource at the specified index and disposes the old resource.

Parameters
index:int

the index of the resource to set

resource:Disposable

the new resource

Returns:boolean

true if the resource has ben set, false if the composite has been disposed