如果StrTemp.equals(true),我想要如下代码(我这里有 2 个线程):
ExecutorService executor = Executors.newFixedThreadPool(2);
Future<String> f1 = executor.submit(new Callable<String >() {
public String call() throws Exception {
return dao.getS4PricingResponse(pricingRequestTemp);
}
});
Future<String> f2 = executor.submit(new Callable<String>() {
public String call() throws Exception {
return dao.getS4ProductResponse(productRequestTemp);
}
});
如果不是真的,我想要创建三个线程。我会再添加一个f3=executor.submit。我怎样才能动态地决定这一点并使其更有效率?
幕布斯6054654
相关分类