com.arsdigita.util
Class ConcurrentDict

java.lang.Object
  extended bycom.arsdigita.util.ConcurrentDict

public final class ConcurrentDict
extends Object

This class allows you to intern objects in an efficient, thread-safe manner.

The classic example of interning is String.intern(). Interning confers two benefits:

Note: using this class may cause a deadlock, if the methods get(Object) and ConcurrentDict.EntrySupplier.supply(Object) are mutually recursive. Please examine the implementation before using this class.

Since:
2004-02-20
Version:
$Revision: #3 $ $DateTime: 2004/04/07 16:07:11 $
Author:
Vadim Nasardinov (vadimn@redhat.com)

Nested Class Summary
static interface ConcurrentDict.EntrySupplier
           
 
Constructor Summary
ConcurrentDict(ConcurrentDict.EntrySupplier supplier)
           
 
Method Summary
 Object get(Object key)
          Returns the object mapped to this key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConcurrentDict

public ConcurrentDict(ConcurrentDict.EntrySupplier supplier)
Throws:
NullPointerException - if supplier is null
Method Detail

get

public Object get(Object key)
Returns the object mapped to this key.

If no object has been mapped to this key yet, this method will call the ConcurrentDict.EntrySupplier.supply(Object) method of the supplier provided to this dictionary at construction time in ConcurrentDict(ConcurrentDict.EntrySupplier).

Note that the null key is always mapped to null.

See Also:
ConcurrentDict.EntrySupplier.supply(Object), ConcurrentDict(ConcurrentDict.EntrySupplier)


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2337 UTC