Synchronize memoized resource getter
This commit is contained in:
parent
3f870c4a1f
commit
5bbc697a76
|
@ -32,10 +32,12 @@ class MemoizedResource<R> implements Resource<R> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R get() throws Exception {
|
public R get() throws Exception {
|
||||||
if (value == null) {
|
synchronized (resource) {
|
||||||
value = resource.get();
|
if (value == null) {
|
||||||
|
value = resource.get();
|
||||||
|
}
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
return value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue