org.castor.cache.hashbelt.container
Class MapContainer

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.concurrent.ConcurrentHashMap<java.lang.Object,java.lang.Object>
          extended by org.castor.cache.hashbelt.container.MapContainer
All Implemented Interfaces:
java.io.Serializable, java.util.concurrent.ConcurrentMap<java.lang.Object,java.lang.Object>, java.util.Map<java.lang.Object,java.lang.Object>, Container

public final class MapContainer
extends java.util.concurrent.ConcurrentHashMap<java.lang.Object,java.lang.Object>
implements Container

A very basic, HashMap-based implementation of the hashmap container strategy, using nothing more than a basic hashmap to store key/value pairs. This works well for lots of gets and a reasonably high volume of removes; if few removes are required, and iterators are important to your particluar use-case of the cache, it's better to use the FastIteratingContainer, which can handle iterating at a higher speed, still has a map for accessing hash values, but has a higher removal cost.

Since:
1.0
Version:
$Revision: 8102 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $
Author:
Gregory Block, Ralf Joachim
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
MapContainer()
           
 
Method Summary
 long getTimestamp()
          Returns the timestamp of this container.
 java.util.Iterator<java.lang.Object> keyIterator()
          Returns an iterator over the keys contained in this container.
 void updateTimestamp()
          Set the timestamp of this container to System.currentTimeMillis().
 java.util.Iterator<java.lang.Object> valueIterator()
          Returns an iterator over the values contained in this container.
 
Methods inherited from class java.util.concurrent.ConcurrentHashMap
clear, contains, containsKey, containsValue, elements, entrySet, get, isEmpty, keys, keySet, put, putAll, putIfAbsent, remove, remove, replace, replace, size, values
 
Methods inherited from class java.util.AbstractMap
clone, equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Constructor Detail

MapContainer

public MapContainer()
Method Detail

updateTimestamp

public void updateTimestamp()
Set the timestamp of this container to System.currentTimeMillis().

Specified by:
updateTimestamp in interface Container

getTimestamp

public long getTimestamp()
Returns the timestamp of this container.

Specified by:
getTimestamp in interface Container
Returns:
The timestamp.

keyIterator

public java.util.Iterator<java.lang.Object> keyIterator()
Returns an iterator over the keys contained in this container. If the container is modified while an iteration is in progress, the results of the iteration is not affected and vice-versa.

Specified by:
keyIterator in interface Container
Returns:
An iterator over the keys currently contained in the container.

valueIterator

public java.util.Iterator<java.lang.Object> valueIterator()
Returns an iterator over the values contained in this container. If the container is modified while an iteration is in progress, the results of the iteration is not affected and vice-versa.

Specified by:
valueIterator in interface Container
Returns:
An iterator over the values currently contained in the container.


Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com