@Experimental
public sealed interface SnapshotUpdater
Represents the context of a snapshot build.
Used in
Snapshotable.updateSnapshot(SnapshotUpdater)
to create snapshot references and avoid circular dependencies.
Updaters must never leave scope, as its data may be state related (change according to the currently processed snapshot).
Implementations do not need to be thread-safe and cannot be re-used.
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T extends Snapshot>
AtomicReference<T> optionalReference
(Snapshotable snapshotable) <T extends Snapshot>
AtomicReference<T> reference
(Snapshotable snapshotable) default <T extends Snapshot,
S extends Snapshotable, K>
Map<K, AtomicReference<T>> referencesMap
(Collection<S> snapshotables, Function<S, K> mappingFunction) default <T extends Snapshot,
S extends Snapshotable>
Map<Integer, AtomicReference<T>> referencesMapInt
(Collection<S> snapshotables, ToIntFunction<S> mappingFunction) default <T extends Snapshot,
S extends Snapshotable>
Map<Long, AtomicReference<T>> referencesMapLong
(Collection<S> snapshotables, ToLongFunction<S> mappingFunction) static <T extends Snapshot>
Tupdate
(Snapshotable snapshotable) Updates the snapshot of the given snapshotable.
-
Method Details
-
update
Updates the snapshot of the given snapshotable.Method must be called during a safe-point (when the server state is stable).
- Type Parameters:
T
- the snapshot type- Parameters:
snapshotable
- the snapshot container- Returns:
- the new updated snapshot
-
reference
-
optionalReference
@Contract("!null -> !null") default <T extends Snapshot> AtomicReference<T> optionalReference(Snapshotable snapshotable) -
referencesMap
default <T extends Snapshot,S extends Snapshotable, Map<K,K> AtomicReference<T>> referencesMap(Collection<S> snapshotables, Function<S, K> mappingFunction) -
referencesMapLong
default <T extends Snapshot,S extends Snapshotable> Map<Long,AtomicReference<T>> referencesMapLong(Collection<S> snapshotables, ToLongFunction<S> mappingFunction) -
referencesMapInt
default <T extends Snapshot,S extends Snapshotable> Map<Integer,AtomicReference<T>> referencesMapInt(Collection<S> snapshotables, ToIntFunction<S> mappingFunction)
-