org.sourceforge.jemm.util.managed.bucket
Class BucketLockedBucket<K,V>

java.lang.Object
  extended by org.sourceforge.jemm.util.managed.bucket.BucketLockedBucket<K,V>
Type Parameters:
K - The key type
V - The value type.
All Implemented Interfaces:
ECMapBucket<K,V>

public class BucketLockedBucket<K,V>
extends java.lang.Object
implements ECMapBucket<K,V>

A bucket which locks the entire bucket (i.e. hashgroup when actions occur on items managed within this bucket.

Implementation note: This is done by making all methods a synchronized wrapper around an internal map.

Author:
Rory Graves

Constructor Summary
BucketLockedBucket()
           
 
Method Summary
 void clear()
           
 boolean contains(V value)
           
 boolean containsKey(K key)
           
 V get(K key)
           
 void perform(K key, ECMAction<K,V> action)
           
 V put(K key, V value)
           
 V putIfAbsent(K key, V value)
           
 V remove(K key)
           
 boolean remove(K key, V value)
           
 V replace(K key, V value)
           
 boolean replace(K key, V oldValue, V newValue)
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BucketLockedBucket

public BucketLockedBucket()
Method Detail

perform

public void perform(K key,
                    ECMAction<K,V> action)
Specified by:
perform in interface ECMapBucket<K,V>

size

public int size()
Specified by:
size in interface ECMapBucket<K,V>
Returns:
The number of entries currently stored within the bucket.

clear

public void clear()
Specified by:
clear in interface ECMapBucket<K,V>

containsKey

public boolean containsKey(K key)
Specified by:
containsKey in interface ECMapBucket<K,V>

contains

public boolean contains(V value)
Specified by:
contains in interface ECMapBucket<K,V>

get

public V get(K key)
Specified by:
get in interface ECMapBucket<K,V>

put

public V put(K key,
             V value)
Specified by:
put in interface ECMapBucket<K,V>

putIfAbsent

public V putIfAbsent(K key,
                     V value)
Specified by:
putIfAbsent in interface ECMapBucket<K,V>

remove

public boolean remove(K key,
                      V value)
Specified by:
remove in interface ECMapBucket<K,V>

remove

public V remove(K key)
Specified by:
remove in interface ECMapBucket<K,V>

replace

public V replace(K key,
                 V value)
Specified by:
replace in interface ECMapBucket<K,V>

replace

public boolean replace(K key,
                       V oldValue,
                       V newValue)
Specified by:
replace in interface ECMapBucket<K,V>


Copyright © 2009. All Rights Reserved.