cz.cuni.amis.utils.maps
Class SyncHashMap<K,V>

Package class diagram package SyncHashMap
java.lang.Object
  extended by cz.cuni.amis.utils.maps.SyncHashMap<K,V>
Type Parameters:
K -
V -

public class SyncHashMap<K,V>
extends Object

THREAD-SAFE unless you misuse getMap() without locking getReadLock() or getWriteLock() according to the operation you want to perform.

Author:
Jimmy

Constructor Summary
SyncHashMap()
           
 
Method Summary
 V get(Object key)
           
 Map<K,V> getMap()
          Use with care ...
 Lock getReadLock()
          Returns READ LOCK.
 Lock getWriteLock()
          Returns WRITE LOCK.
 V put(K key, V value)
           
 V remove(K key)
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SyncHashMap

public SyncHashMap()
Method Detail

put

public V put(K key,
             V value)

remove

public V remove(K key)

get

public V get(Object key)

size

public int size()

getMap

public Map<K,V> getMap()
Use with care ... you need to synchronize read/writes via getReadLock() and getWriteLock().

Returns:

getReadLock

public Lock getReadLock()
Returns READ LOCK.

Returns:

getWriteLock

public Lock getWriteLock()
Returns WRITE LOCK.

Returns:


Copyright © 2013 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.