just badly recreating threadpool in case thread is stuck

This commit is contained in:
jenz 2023-02-10 23:53:30 +01:00
parent 845c6dd0c0
commit 4c098cd683

View File

@ -27,7 +27,7 @@ import java.util.regex.Pattern;
public class Datahandler {
private ExecutorService pool = Executors.newFixedThreadPool(7);
private ExecutorService pool = Executors.newFixedThreadPool(4);
private CompletionService completionService = new ExecutorCompletionService(pool);
private HashMap<String, Annotation> pipelineAnnotationCache;
private HashMap<String, Annotation> pipelineSentimentAnnotationCache;
@ -716,10 +716,18 @@ public class Datahandler {
}
} catch (InterruptedException e) {
//throw new RuntimeException(e);
--pending;
pending = 0;
System.out.printf(Arrays.toString(e.getStackTrace()));
pool.shutdown();
pool = Executors.newFixedThreadPool(4);
completionService = new ExecutorCompletionService(pool);
} catch (ExecutionException e) {
//throw new RuntimeException(e);
--pending;
pending = 0;
System.out.printf(Arrays.toString(e.getStackTrace()));
pool.shutdown();
pool = Executors.newFixedThreadPool(4);
completionService = new ExecutorCompletionService(pool);
}
}