在实现类中,运用线程池
serviceImpl.java
//定义线程池
private static ThreadPoolExecutor executor1 = new ThreadPoolExecutor(10, 100, 300, TimeUnit.SECONDS, new LinkedBlockingDeque<Runnable>());
...
Future<Result> future = executor1.submit(new Validate(li, saler,level,startDate,endDate));
...
//这是内部类,实现了Callable
class Validate implements Callable<Result> {
public Validate(List<Long> data,String saler,Integer level,Long startDate,Long endDate) {
this.data = data;
this.saler = saler;
this.level = level;
this.startDate = startDate;
this.endDate = endDate;
}
@Override
public SkuValidateResult call() {
Result Result = new Result();
return Result;
}
}