How expensive is creating of a new thread in Java? When should we consider using of a thread pool?
问题 I wonder where is the verge after which a thread pool should be used. How many new threads per second can I create without using a thread pool still avoiding noticeable performance penalty? Are there any observable open-source thread-pool implementations? 回答1: You should always use a thread pool. Not just for performance, but for the ease of use the java.util.concurrent package gives you. With Java 5 and later, thread pooling is built in. Instead of thinking in terms of 'threads', use the