Am 28.09.2010 10:32, schrieb Patricia Shanahan:
Sebastian Millies wrote:
Hello there,
what factors should I consider when choosing between a
ConcurrentLinkingQueue and a LinkedBlockingQueue as a
queue implementation?
>It all depends. If you go with the non-blocking version you will
>probably need to put a Thread.sleep() call in each consumer's poll
loop,
[snip]
In general, good modularity can put off a lot of "which is faster"
decisions until you have the program working and can measure it. At that
point you only have to work on those "which is faster" decisions that
have real performance impact. Finding out which implementation is faster
is easy when the decision is internal to a single class that is taking a
significant amount of time in a program you can measure.
Patricia
thanks, I think that is good advice. BTW, the non-blocking code looked
simpler at first because there was no InterruptedException to deal
with, but that was because I hadn't thought of the need to sleep.
number of CPU cores. Throughput of consumers and producers, etc...