1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-23 16:28:51 -05:00

Synchronize memoized resource getter

This commit is contained in:
Reinhard Pointner 2016-04-08 22:59:21 +00:00
parent 3f870c4a1f
commit 5bbc697a76

View File

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