commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Smith" <mich...@iammichael.org>
Subject RE: SequencedHashMap: This class is thread-safe (was Re: Silly Question)
Date Fri, 25 Jan 2002 00:04:49 GMT
You might be confused which class John was referring to.  The non-thread
safe class is org.apache.commons.collections.SequencedHashMap.  There
isn't a single synchronized keyword in that entire file.

michael

> -----Original Message-----
> From: Janek Bogucki [mailto:janekdb@yahoo.co.uk]
> Sent: Thursday, January 24, 2002 5:28 PM
> To: Jakarta Commons Developers List
> Subject: SequencedHashMap: This class is thread-safe (was Re: Silly
> Question)
>
>
> Hi John,
>
>  --- John McNally <jmcnally@collab.net> wrote: > >
> > Remove the "This class is thread-safe" declaration
> > in SequencedHashMap.
>
> When I first read this class through I thought I'd
> spotted a race condition in freshenSequence but a
> rethink convinced me it was not thread-unsafe. Am I
> wrong here? If not, what's the actual location of the
> non thread-safe behaviour?
>
> -Janek
>
>     /**
>      * Freshens the sequence of the element
> <code>value</code> if
>      * <code>value</code> is not <code>null</code>.
>      *
>      * @param key   The key whose sequence to freshen.
>      * @param value The value whose existance to check
> before removing the old
>      *              key sequence.
>      */
>     protected void freshenSequence(Object key, Object
> value)
>     {
>         if (value != null)
>         {
>             // Freshening existing element's sequence.
>             keySequence.remove(key);
>         }
>         keySequence.add(key);
>     }
>
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
>
> --
> To unsubscribe, e-mail:
> <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:commons-dev-help@jakarta.apache.org>



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