File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
src/main/java/org/springframework/data/util Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change 30
30
*
31
31
* @author Oliver Gierke
32
32
* @author Mark Paluch
33
+ * @author Henning Rohlfs
33
34
* @since 2.0
34
35
*/
35
36
public class Lazy <T > implements Supplier <T > {
@@ -39,7 +40,7 @@ public class Lazy<T> implements Supplier<T> {
39
40
private final Supplier <? extends T > supplier ;
40
41
41
42
private @ Nullable T value ;
42
- private boolean resolved ;
43
+ private volatile boolean resolved ;
43
44
44
45
/**
45
46
* Creates a new {@link Lazy} instance for the given supplier.
@@ -222,18 +223,14 @@ public <S> Lazy<S> flatMap(Function<? super T, Lazy<? extends S>> function) {
222
223
@ Nullable
223
224
public T getNullable () {
224
225
225
- T value = this .value ;
226
-
227
226
if (this .resolved ) {
228
- return value ;
227
+ return this . value ;
229
228
}
230
229
231
- value = supplier .get ();
232
-
233
- this .value = value ;
230
+ this .value = supplier .get ();
234
231
this .resolved = true ;
235
232
236
- return value ;
233
+ return this . value ;
237
234
}
238
235
239
236
/*
You can’t perform that action at this time.
0 commit comments