diff --git a/src/main/java/ru/ulstu/service/MethodParamBruteForce.java b/src/main/java/ru/ulstu/service/MethodParamBruteForce.java index 57a31b5..38cdc2a 100644 --- a/src/main/java/ru/ulstu/service/MethodParamBruteForce.java +++ b/src/main/java/ru/ulstu/service/MethodParamBruteForce.java @@ -33,7 +33,8 @@ class MethodParamBruteForce { private final int DEFAULT_THREAD_COUNT = 50; private final List methods; private final ScoreMethod scoreMethod = new Smape(); - private final ExecutorService executors = Executors.newFixedThreadPool(DEFAULT_THREAD_COUNT); + private final ExecutorService executors = Executors.newCachedThreadPool(); + ; public MethodParamBruteForce(List methods) { this.methods = methods; @@ -74,7 +75,7 @@ class MethodParamBruteForce { for (Future futureModelingResult : futureModelingResults) { modelingResults.add(futureModelingResult.get()); } - + System.gc(); return getBestResultForecast(modelingResults, timeSeries, countPoints); } @@ -159,6 +160,7 @@ class MethodParamBruteForce { for (Future futureModelingResult : results) { results2.add(futureModelingResult.get()); } + System.gc(); return results2.stream() .min(Comparator.comparing(modelingResult -> modelingResult.getScore().getDoubleValue())) .orElse(null); @@ -189,6 +191,7 @@ class MethodParamBruteForce { for (Future futureModelingResult : results) { results2.add(futureModelingResult.get()); } + System.gc(); return results2.stream() .min(Comparator.comparing(modelingResult -> modelingResult.getScore().getDoubleValue())) .orElse(null);