Persistent Variables in ExecutorService (Java)

后端 未结 3 543
Happy的楠姐
Happy的楠姐 2021-01-18 17:09

I\'ve created a pool of 4 worker threads to process some files. In the test there\'s about 200 of them. The thread pool version is already about 3 times faster than doing it

3条回答
  •  星月不相逢
    2021-01-18 17:42

    You can use an object pool for your message digest objects. And set the pool size to 4 in your case.

    apache commons provides excellent pool api: http://commons.apache.org/pool/

提交回复
热议问题