spring、springMVC简单应用FutureTask(线程池)

一、在beans.xml或spring-mvc.xml等spring、springMVC的配置文件里配置ThreadPoolTaskExecutor

class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">






















二、使用

@Autowired
ThreadPoolTaskExecutor threadPoolTaskExecutor;


FutureTask result = null;
// try {
result = new FutureTask(new Callable() {
@Override
public Object call() throws Exception {
//do something
}
});
threadPoolTaskExecutor.execute(result);



你可能感兴趣的:(springMVC)