The extract() method is called by poll(), poll () with args and take().
The removeAt() method is called by the remove() and the Iterator - remove()
The "count" variable is decremented in both extract() and removeAt(). When I ran the test using a stress engine, count got decremented and became negative. Please note that in some of the above methods, an interruptible lock is used and has the chance of being woken up in the middle, lets say when the count becomes 0. Meanwhile, another thread could get into the extract(). Now without any condition checks here, I would get an NegativeArraySize exception, which is what I got when I ran the multi-threaded tests.
So using the "count" condition clauses inside the extract() and the removeAt() seemed to be the better option, rather than trying to implement these conditions in the calling methods. Please let me know if you need the tests for these. I can send it to you offline.