mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-04 08:25:03 -05:00
Make sure that LocalIndex for different years can be computed concurrently (e.g. 1-2 second speedup when processing single movie files)
This commit is contained in:
parent
1390a23318
commit
8efa664d76
@ -9,13 +9,13 @@ import static net.filebot.media.MediaDetection.*;
|
|||||||
import static net.filebot.util.FileUtilities.*;
|
import static net.filebot.util.FileUtilities.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
@ -134,7 +134,7 @@ public final class WebServices {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// local TheMovieDB search index
|
// local TheMovieDB search index
|
||||||
private final Map<Integer, LocalSearch<Movie>> localIndexPerYear = synchronizedMap(new HashMap<>());
|
private final Map<Integer, LocalSearch<Movie>> localIndexPerYear = new ConcurrentHashMap<>(64);
|
||||||
|
|
||||||
private LocalSearch<Movie> getLocalIndexByYear(int year) {
|
private LocalSearch<Movie> getLocalIndexByYear(int year) {
|
||||||
return localIndexPerYear.computeIfAbsent(year, y -> {
|
return localIndexPerYear.computeIfAbsent(year, y -> {
|
||||||
|
Loading…
Reference in New Issue
Block a user