private final ExecutorService executorParsers = Executors.newFixedThreadPool(10);
public void parse(List<MyObjInt> objs) {
//... bunch of elided stuff ....
CompletionService<AsupParseObj> parserService = new ExecutorCompletionService<AsupParseObj>(executorParsers);
for (final AsupStoreObj obj : objs) {
parserService.submit(new ParseThread(obj));
}
}
我想对“ParseThread”进行DI,但肯定有比将getBean调用封装在原型作用域的Bean里更好的方法,因为我是Spring的新手,所以我想问问……