commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Janek Bogucki <...@studylink.com>
Subject Re: FastArrayList, FastHashMap, FastTreeMap not thread safe
Date Wed, 10 Apr 2002 09:53:14 GMT
Hi,

> From: Christoph Reck <Christoph.Reck@dlr.de>
> Organization: DFD-DLR
> Reply-To: "Jakarta Commons Developers List" <commons-dev@jakarta.apache.org>
> Date: Wed, 10 Apr 2002 11:01:17 +0200
> To: Jakarta Commons Developers List <commons-dev@jakarta.apache.org>
> Subject: Re: FastArrayList, FastHashMap, FastTreeMap not thread safe
> 
> Paul, the contract of the Fast* collections is to be usable
> within *one* thread or in a context where a sychronisation
> is done outside by an encapsualting owner class. That is
> the reason for allowing it to be fast. This was discussed
> in the thrads at the time where these collections found
> their way in.
> 
> Fast* designers please correct me if I'm wrong (I'm just
> recollecting this from my memory - which is near to overflowing
> with some threads here...;).
> 
> :) Christoph
> 

This description is from
http://jakarta.apache.org/commons/collections/api/org/apache/commons/collect
ions/FastHashMap.html


public class FastHashMap
extends HashMap

A customized implementation of java.util.HashMap designed to operate in a
multithreaded environment where the large majority of method
calls are read-only, instead of structural changes. When operating in "fast"
mode, read calls are non-synchronized and write calls perform the
following steps:

       Clone the existing collection
       Perform the modification on the clone
       Replace the existing collection with the (modified) clone

When first created, objects of this class default to "slow" mode, where all
accesses of any type are synchronized but no cloning takes place.
This is appropriate for initially populating the collection, followed by a
switch to "fast" mode (by calling setFast(true)) after initialization is
complete.

NOTE: If you are creating and accessing a HashMap only within a single
thread, you should use java.util.HashMap directly (with no
synchronization), for maximum performance.

Version: 
       $Revision: 1.1 $ $Date: 2001/08/17 23:26:28 $

-Janek


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