T
- the type of the represented objectpublic interface SharedReference<T> extends Serializable
SharedObjects
. The reference can be serialized and will
still point to the same instance after deserialization in the same JVM. The underlying object may
change the state but this reference will never point to another object.Modifier and Type | Method and Description |
---|---|
default <R> R |
applySync(java.util.function.Function<T,R> function)
Executes the code on the referenced object in a synchronized fashion.
|
default void |
consumeSync(java.util.function.Consumer<T> consumer)
Executes the code on the referenced object in a synchronized fashion.
|
T |
get()
Returns the referenced object without giving any visibility guarantees.
|
T get()
default <R> R applySync(java.util.function.Function<T,R> function)
default void consumeSync(java.util.function.Consumer<T> consumer)
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.