我有一个springboot应用程序,我使用线程从csv文件读取数据并将它们存储在数据库中。但我的内存正在耗尽。cpu被完全利用。我怎样才能解决这个问题?
有没有办法从jvm参数中增加堆的大小?
@Bean(name = "MainDepositExecutor")
@Primary
public TaskExecutor workExecutor() {
ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
threadPoolTaskExecutor.setCorePoolSize(taskCorePoolSize);
threadPoolTaskExecutor.setMaxPoolSize(maximumThreadPoolSize);
threadPoolTaskExecutor.setQueueCapacity(queueCapacity);
threadPoolTaskExecutor.afterPropertiesSet();
log.info("mainDepositExecutor ThreadPoolTaskExecutor set");
return threadPoolTaskExecutor;
}
where taskCorePoolSize=1
maximumThreadPoolSize=1
queueCapacity=50
暂无答案!
目前还没有任何答案,快来回答吧!