Top Description Fields Constructors Methods
io.reactivex.internal.subscriptions

public final Class ArrayCompositeSubscription

extends AtomicReferenceArray<Subscription>
implements Disposable
Class Inheritance
All Implemented Interfaces
io.reactivex.disposables.Disposable
Imports
java.util.concurrent.atomic.AtomicReferenceArray, org.reactivestreams.Subscription, io.reactivex.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.disposables.Disposable.dispose.

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

Implements io.reactivex.disposables.Disposable.isDisposed.

Returns true if this resource has been disposed.
public Subscription

Returns:

the old resource, can be null
replaceResource
(int
the index of the resource to replace
index
,
Subscription
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
,
Subscription
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

ArrayCompositeSubscriptionback to summary
public ArrayCompositeSubscription(int capacity)

Method Detail

disposeback to summary
public void dispose()

Implements io.reactivex.disposables.Disposable.dispose.

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

Dispose the resource, the operation should be idempotent.

Annotations
@Override
isDisposedback to summary
public boolean isDisposed()

Implements io.reactivex.disposables.Disposable.isDisposed.

Doc from io.reactivex.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 Subscription replaceResource(int index, Subscription resource)

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

Parameters
index:int

the index of the resource to replace

resource:Subscription

the new resource

Returns:Subscription

the old resource, can be null

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

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

Parameters
index:int

the index of the resource to set

resource:Subscription

the new resource

Returns:boolean

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