anserini icon indicating copy to clipboard operation
anserini copied to clipboard

Refactor ThreadPoolExecutor to use try-with-resources

Open lintool opened this issue 1 year ago • 0 comments

We use ThreadPools in many places throughout the codebase, e.g., https://github.com/castorini/anserini/blob/master/src/main/java/io/anserini/search/HnswDenseSearcher.java

Best practices starting Java 19 I believe is to use try-with-resources blocks, e.g., https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/util/concurrent/ExecutorService.html

 try (ExecutorService e =  Executors.newWorkStealingPool()) {
   // submit or execute many tasks with e ...
 }

lintool avatar Aug 27 '24 18:08 lintool