This is an automated email from the ASF dual-hosted git repository.
sk0x50 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new d46ac208937 IGNITE-28386 Fix non-safe publication of a value in Lazy
class (#7891)
d46ac208937 is described below
commit d46ac208937b32fbebc3e5d615f36eea28465253
Author: Slava Koptilin <[email protected]>
AuthorDate: Fri Mar 27 16:02:51 2026 +0200
IGNITE-28386 Fix non-safe publication of a value in Lazy class (#7891)
Co-authored-by: korlov42 <[email protected]>
---
.../core/src/main/java/org/apache/ignite/internal/util/Lazy.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/util/Lazy.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/Lazy.java
index e1680140493..41310de77a5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/Lazy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/Lazy.java
@@ -32,12 +32,13 @@ public class Lazy<T> {
private volatile Supplier<T> supplier;
- // This is a safe race, because we follow two simple rules: single read
and safe initialization
- @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
- private @Nullable T val;
+ private volatile @Nullable T val;
/**
- * Creates the lazy value with the given value supplier.
+ * Creates the lazy value with the given value supplier.
+ *
+ * <p>In case of the given {@code supplier} throws an exception, the next
call to {@link #get()} will re-invoke the supplier.
+ * Take this into account especially when the supplier has side effects.
*
* @param supplier A supplier of the value.
*/