Package org.apache.flink.testutils.junit
Interface SharedReference<T>
- Type Parameters:
T- the type of the represented object
- All Superinterfaces:
Serializable
Represents an object managed in a
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.-
Method Summary
Modifier and TypeMethodDescriptiondefault <R> RExecutes the code on the referenced object in a synchronized fashion.default voidconsumeSync(Consumer<T> consumer) Executes the code on the referenced object in a synchronized fashion.get()Returns the referenced object without giving any visibility guarantees.
-
Method Details
-
get
T get()Returns the referenced object without giving any visibility guarantees. This method should only be used on thread-safe classes. -
applySync
Executes the code on the referenced object in a synchronized fashion. Note that this method is prone to deadlock if multiple references are accessed in a synchronized fashion in a nested call-chain. -
consumeSync
Executes the code on the referenced object in a synchronized fashion. Note that this method is prone to deadlock if multiple references are accessed in a synchronized fashion in a nested call-chain.
-