org.sourceforge.jemm.util
Class ManagedItemStore<K,V extends ManagedItem<K>>

java.lang.Object
  extended by org.sourceforge.jemm.util.ManagedItemStore<K,V>

public abstract class ManagedItemStore<K,V extends ManagedItem<K>>
extends java.lang.Object


Field Summary
static int DEFAULT_CACHED_ELEMENTS_PER_SEGMENT
          The default number of cached elements to hold per segment
static int DEFAULT_SEGMENTS
          The default number of lock segments to use
 
Constructor Summary
protected ManagedItemStore()
          Create a ManagedItemStore with the default number of segments and cached elements
protected ManagedItemStore(int noSegments, int noCachedElementsPerSegment)
           
 
Method Summary
 V acquire(K key)
           
 V acquire(K key, boolean createIfMissing)
           
protected abstract  V createValueElement(K key)
           
 void release(K key)
           
 int size()
          Returns the number of entries held in the store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SEGMENTS

public static final int DEFAULT_SEGMENTS
The default number of lock segments to use

See Also:
Constant Field Values

DEFAULT_CACHED_ELEMENTS_PER_SEGMENT

public static final int DEFAULT_CACHED_ELEMENTS_PER_SEGMENT
The default number of cached elements to hold per segment

See Also:
Constant Field Values
Constructor Detail

ManagedItemStore

protected ManagedItemStore()
Create a ManagedItemStore with the default number of segments and cached elements


ManagedItemStore

protected ManagedItemStore(int noSegments,
                           int noCachedElementsPerSegment)
Method Detail

acquire

public V acquire(K key)

acquire

public V acquire(K key,
                 boolean createIfMissing)

release

public void release(K key)

createValueElement

protected abstract V createValueElement(K key)

size

public final int size()
Returns the number of entries held in the store. (Not atomic).

Returns:
The number of entries in the store.


Copyright © 2009. All Rights Reserved.