commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack, Paul" <pj...@sfaf.org>
Subject [Collections] StaticBucketMap not thread safe
Date Tue, 25 Jun 2002 20:12:36 GMT
Ugh.  StaticBucketMap has double-checked-locking-esque problems.

Since access to the node array (m_buckets) isn't synchronized,
different processors can disagree as to whether an element in
that array is null or not.

Worse, the reference to a Node placed in that array can be
written before the Node is fully constructed, because compilers/
pipelines can feel free to reorder those instructions.  Almost every
operation on a StaticBucketMap can therefore fail in unexpected
ways.

Only way to fix it is to synchronize every access to m_buckets.
I'm not sure how badly that will affect performance but it definitely
wouldn't be as optimized.

-Paul

--
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