问题描述
我正在尝试从远程Splunk服务器执行获取日志操作。我的CPU有4个核心。我正在使用Executor Framework,CorePoolSize为4。但是,只有1个线程正在获取日志。我应该怎么做才能使4个线程同时工作?
代码:
public Executor taskExecutor(){
ThreadPoolTaskExecutor executor= new ThreadPoolTaskExecutor();
executor.setCorePoolSize(Runtime.getRuntime().availableProecssors());
executor.setMaxPoolSIze(10);
executor.setQueueCapacity(100);
executor.initialize();
return executor;
}
解决方法
您说过要获取日志,也许您不能同时打开同一文件和/或对其进行操作。