[concurrency-interest] private field
Thu, 14 Oct 2004 14:07:02 +1000
> Here, we have all we want: concurrency, performance and low memory
Ah I see. My gut reaction is that we should have had a drainTo(T ta)
method. :( I guess the thinking was that draining to a collection was more
generally useful and you can use an ArrayList to then get to an array.
Otherwise your requirements for fast, concurrent and low-memory usage seem
to only be pair-wise compatible:
- fast & concurrent -> needs the extra ArrayList to drain to (though I guess
you could try and reuse this?)
- fast & low-memory -> needs more locking
Plus the need for atomic removal precludes other potential solutions, such
as iterating through and removing (not to mention that the iterator has a
lot of locking), or a simple polling loop.
Maybe someone else can think of something.