Reputation: 38633
How do I create a Thread Pool with a LinkedBlockingQueue in Java? I am using this to download files from the internet. I just need the general pattern.
Upvotes: 0
Views: 600
Reputation: 11
Here is one demo :
public static ExecutorService newLinkedBlockingQueueThreadPool() {
return new ThreadPoolExecutor(0, Integer.MAX_VALUE,
60L, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>());
}
Upvotes: 1
Reputation: 403551
ThreadPoolExecutor
has various constructors that take a BlockingQueue
argument. There are several other parameters, though, and you'll need to pick the ones appropriate for your problem.
Upvotes: 2