This commit is contained in:
Reinhard Pointner 2016-03-09 05:58:41 +00:00
parent 360e0b5a55
commit 535a16621c
1 changed files with 4 additions and 6 deletions

View File

@ -27,13 +27,11 @@ class MemoizedResource<R> implements Resource<R> {
} }
@Override @Override
public R get() throws Exception { public synchronized R get() throws Exception {
synchronized (resource) { if (value == null) {
if (value == null) { value = resource.get();
value = resource.get();
}
return value;
} }
return value;
} }
} }