[concurrency-interest] Asynchronous-nature of ConcurrentLinkedQueue

Kai Meder stuff at kai.meder.info
Tue May 18 08:03:29 EDT 2010


Hello

reading the Java-Docs of ConcurrentLinkedQueue I wonder what the
"asynchronous nature" mentioned in the size()-doc is?

"Beware that, unlike in most collections, this method is NOT a
constant-time operation. Because of the asynchronous nature of these
queues, determining the current number of elements requires an O(n)
traversal. "

I read the source and there is looping until expectations on the
atomic-references are met, is this asynchronous?

Thanks, Kai


More information about the Concurrency-interest mailing list