import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
/**
* @author lisa
* @create 2020-08-11-16:19
*/
public class ExecutorTest {
public static void main(String[] args) {
ExecutorService service=Executors.newFixedThreadPool(10);
//适合Callable
System.out.println(service.getClass());
ThreadPoolExecutor the= (ThreadPoolExecutor) service;
the.setCorePoolSize(15);
service.submit(new Callable<Integer>() {
@Override
public Integer call() throws Exception {
return null;
}
});//适合Callable(均可)
service.execute(new Runnable() {
@Override
public void run() {
}
});//适合Runnable接口
}
}