Persistent Variables in ExecutorService (Java)
问题 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 sequentially but there is room for improvement. The biggest bottleneck (ignoring disk I/O) is that I need to instantiate a new MessageDigest object. In the single threaded version I just had 1. In this version I have 200. What I was wondering was, is it possible to have a variable local to the thread in the work pool? That