为每个请求提供新的ThreadPoolExecutor,或创建ThreadPoolExecutor的单例Spring bean

时间:2019-02-25 12:58:30

标签: java spring multithreading threadpoolexecutor

我有一个Restful服务,可以将图像上传到S3存储桶。我当时在考虑使用ThreadPoolExecutor进行并行上传。

但是我应该创建一个全局池(例如Spring单例bean),还是在每个请求上创建一个新的ThreadPoolExecutor

不确定创建一个bean是否是个好主意,因为corePoolSize个线程在应用程序中总是存在的。 谢谢,谢谢。

0 个答案:

没有答案