I will attempt to explain how I understand it..
i.e. The ArrayBlockingQueue is bounded with the capacity argument supplied when constructing it. If the Queue turns out to be short when rate of object adding gets high it will block and this may reduce the objects "passing through" the queue in a unit time.
Whereas in the LinkedBlockingQueue, bounding is optional and the highest capacity is Integer.MAX_VALUE and it can grow up to that value if no lower bound is specified. This should allow more objects to be added to the queue without blocking thereby increasing the throughput. But according to the API this seems to slow down when multiple threads access the LinkedBlockingQueue.
If you can estimate with reasonable accuracy the size of your queue then may be ArrayBlockingQueue is what you need. Othewise LinkedBlockingQueue may have to be it.
Can anybody else confirm?
Originally posted by Uttam Kini:
In the API doc of LinkedBlockingQueue, it says "Linked queues typically have higher throughput than array-based queues but less predictable performance in most concurrent applications"...... This seems a little ambiguous to me.
In which way does it seem to be ambiguous?
1. which thread gets the first priority
2. the speed of insertions and removals is not the same and hence not predictable (since throughput is mentioned on top, this gives it more credibility)
girl power ... turns out to be about a hundred watts. But they seriuosly don't like being connected to the grid. Tiny ad:
The WEB SERVICES and JAX-RS Coursehttps://coderanch.com/t/690789/WEB-SERVICES-JAX-RS