commons-dev mailing list archives

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

> From: Christoph Reck <>
> Organization: DFD-DLR
> Reply-To: "Jakarta Commons Developers List" <>
> Date: Wed, 10 Apr 2002 11:01:17 +0200
> To: Jakarta Commons Developers List <>
> 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

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

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.

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


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message