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