CopyOnWriteArrayList clone bug?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

CopyOnWriteArrayList clone bug?

Jason Mehrens
In revision: 1.51 of the CopyOnWriteArrayList, the resetLock() method is not
invoked on the newly created clone.  Won't this result in one lock being
shared over multiple instances?

Jason Mehrens


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: CopyOnWriteArrayList clone bug?

Doug Lea
Jason Mehrens wrote:
> In revision: 1.51 of the CopyOnWriteArrayList, the resetLock() method is not
> invoked on the newly created clone.  Won't this result in one lock being
> shared over multiple instances?
>

Yes. Thanks VERY much! Hopefully we'll get this change in for Mustang.
It's not quite a bug, but it is not the way anyone wants it to work.

(Note: The Tiger version of this class does not have this problem.
For Mustang, we needed to change to use explicit locks but did not
adjust clone accordingly.)

-Doug

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: CopyOnWriteArrayList clone bug?

Joshua Bloch
Doug,

Interesting, because this is a general "bug pattern."  If you move
from intrinsic lock to an explicit lock and you have a clone method,
you have to fix it.

        Josh

On 9/7/05, Doug Lea <[hidden email]> wrote:

> Jason Mehrens wrote:
> > In revision: 1.51 of the CopyOnWriteArrayList, the resetLock() method is not
> > invoked on the newly created clone.  Won't this result in one lock being
> > shared over multiple instances?
> >
>
> Yes. Thanks VERY much! Hopefully we'll get this change in for Mustang.
> It's not quite a bug, but it is not the way anyone wants it to work.
>
> (Note: The Tiger version of this class does not have this problem.
> For Mustang, we needed to change to use explicit locks but did not
> adjust clone accordingly.)
>
> -Doug
>
> _______________________________________________
> Concurrency-interest mailing list
> [hidden email]
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest