Refactor
This commit is contained in:
parent
360e0b5a55
commit
535a16621c
|
@ -27,14 +27,12 @@ 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;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TransformedResource<R, T> implements Resource<T> {
|
class TransformedResource<R, T> implements Resource<T> {
|
||||||
|
|
Loading…
Reference in New Issue