commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael A. Smith" <...@apache.org>
Subject RE: [SUBMIT][Collections] Buffer stuff from Avalon
Date Fri, 28 Jun 2002 15:59:59 GMT
On Fri, 28 Jun 2002, Jack, Paul wrote:
> > no, that's the way that Sun decided to implement 
> > Collections.synchronizedFoo, so you're right.  I was just 
> > saying that I 
> > thought Sun could have implemented the iterator so that 
> > wasn't required 
> > for a multi-thread safe iterator.
> 
> Well, yes, they could have synchronized the iterator methods
> with the same monitor they used for the collection wrapper, 
> the resulting thread-safe iterators would be kind of useless.
[snip]
> Of course, if you get the ConcurrentModificationException, it probably
> means your iteration was aborted prematurely, and you've have no way 
> of detecting which elements were processed and which ones weren't.

Points well taken.  

> What I'm getting at is, even if Sun provided synchronized iterators,
> you'd still probably want to use them the same way:
> 
>    // block out other threads from making mods
>    synchronized (c) {
>        Iterator i = c.iterator();
>        while (i.hasNext()) process(i.next());
>    }

agreed.

> Having said all that, I removed the synchronized iterator() method
> from BufferUtils.synchronizedBuffer().  I also renamed BoundedFifo
> and UnboundedFifo to BoundedFifoBuffer and UnboundedFifoBuffer per
> Stephen's recommendations.
> 
> The website's been updated with the changes:
> 
> http://www.geocities.com/apachecollections/buffers

cool, thanks

michael


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message