Reputation: 4210
I am using LinkedBlockingQueue for my threadPool
new ThreadPoolExecutor(20,
21,
10,
TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>())
and i suffer from the memory leak Bug (the memory is full of LinkedBlockingQueue Nodes , slowing down gradually), which is fixed in JDK 7.
I dont want to change the run time environment or my JDK for now.
LinkedBlockingQueue has no size limit , unlike the other implementations of BlockingQueue Interface. Can you suggest any alternative queue ?
Upvotes: 2
Views: 1892
Reputation: 109079
The fix bug-id you link to has also been backported to Java 6. It has been fixed in Java 6 since Java 6 Update 19, see https://bugs.java.com/bugdatabase/view_bug?bug_id=2186685 (this one is BTW linked on the bug you refer to).
Upvotes: 4
Reputation: 41220
ArrayBlockingQueue
which is backed by a fixed-sized array.
PriorityBlockingQueue
- it is an unbounded blocking, here the elements of the priority queue are ordered according to their natural ordering, or by a Comparator provided at queue construction time.
Upvotes: 2