Details
-
Improvement
-
Status: Patch Available
-
Minor
-
Resolution: Unresolved
-
3.2.0
-
None
-
None
-
Patch
Description
This collection needs to be thread safe and it needs to repeatedly poll the queue to drain it, so use BlockingQueue which has a drain() method just for this purpose:
This operation may be more efficient than repeatedly polling this queue.
Also, the collection returns 'null' if there is nothing to drain from the queue. This is a confusing and error-prone affect. It should just return an empty list. I've also updated the code to be more consistent and to return a java List in all places instead of a List in some and a native array in others. This will make the entire usage much more consistent and safe.