Enum DisposableHelper
- java.lang.Object
-
- java.lang.Enum<DisposableHelper>
-
- com.forgerock.rxjava3.intern.disposables.DisposableHelper
-
- All Implemented Interfaces:
io.reactivex.rxjava3.disposables.Disposable
,Serializable
,Comparable<DisposableHelper>
public enum DisposableHelper extends Enum<DisposableHelper> implements io.reactivex.rxjava3.disposables.Disposable
Utility methods for working with Disposables atomically.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description DISPOSED
The singleton instance representing a terminal, disposed state, don't leak it.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
static boolean
dispose(AtomicReference<io.reactivex.rxjava3.disposables.Disposable> field)
Atomically disposes the Disposable in the field if not already disposed.boolean
isDisposed()
static boolean
isDisposed(io.reactivex.rxjava3.disposables.Disposable d)
Checks if the given Disposable is the commonDISPOSED
enum value.static boolean
set(AtomicReference<io.reactivex.rxjava3.disposables.Disposable> field, io.reactivex.rxjava3.disposables.Disposable d)
Atomically sets the field and disposes the old contents.static DisposableHelper
valueOf(String name)
Returns the enum constant of this type with the specified name.static DisposableHelper[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
DISPOSED
public static final DisposableHelper DISPOSED
The singleton instance representing a terminal, disposed state, don't leak it.
-
-
Method Detail
-
values
public static DisposableHelper[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (DisposableHelper c : DisposableHelper.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static DisposableHelper valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
isDisposed
public static boolean isDisposed(io.reactivex.rxjava3.disposables.Disposable d)
Checks if the given Disposable is the commonDISPOSED
enum value.- Parameters:
d
- the disposable to check- Returns:
- true if d is
DISPOSED
-
set
public static boolean set(AtomicReference<io.reactivex.rxjava3.disposables.Disposable> field, io.reactivex.rxjava3.disposables.Disposable d)
Atomically sets the field and disposes the old contents.- Parameters:
field
- the target fieldd
- the new Disposable to set- Returns:
- true if successful, false if the field contains the
DISPOSED
instance.
-
dispose
public static boolean dispose(AtomicReference<io.reactivex.rxjava3.disposables.Disposable> field)
Atomically disposes the Disposable in the field if not already disposed.- Parameters:
field
- the target field- Returns:
- true if the current thread managed to dispose the Disposable
-
dispose
public void dispose()
- Specified by:
dispose
in interfaceio.reactivex.rxjava3.disposables.Disposable
-
isDisposed
public boolean isDisposed()
- Specified by:
isDisposed
in interfaceio.reactivex.rxjava3.disposables.Disposable
-
-