org.sourceforge.jemm.client.shared
Class WeakSingletonFactory<K,V>

java.lang.Object
  extended by org.sourceforge.jemm.client.shared.WeakSingletonFactory<K,V>
Direct Known Subclasses:
JEMMObjectFactory, TrackedIDFactoryImpl

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


Field Summary
protected  EnhancedConcurrentHashMap<K,java.lang.ref.WeakReference<V>> keysToWeakRefs
           
protected  java.lang.ref.ReferenceQueue<V> queue
           
protected  java.lang.Thread queueListener
           
protected  java.util.Map<java.lang.ref.WeakReference<V>,K> refsToKeys
           
 
Constructor Summary
WeakSingletonFactory()
           
 
Method Summary
 boolean contains(K key)
           
 V create(K k)
           
protected abstract  V createValue(K k)
           
 V get(K k)
           
protected abstract  void notifyExpired(K k)
           
 void put(K key, V value)
           
 void remove(K key)
           
 void shutdown()
          Stops the listener thread and releases native resources.
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keysToWeakRefs

protected final EnhancedConcurrentHashMap<K,java.lang.ref.WeakReference<V>> keysToWeakRefs

refsToKeys

protected final java.util.Map<java.lang.ref.WeakReference<V>,K> refsToKeys

queue

protected final java.lang.ref.ReferenceQueue<V> queue

queueListener

protected final java.lang.Thread queueListener
Constructor Detail

WeakSingletonFactory

public WeakSingletonFactory()
Method Detail

put

public void put(K key,
                V value)

contains

public boolean contains(K key)

size

public int size()

notifyExpired

protected abstract void notifyExpired(K k)

get

public V get(K k)

remove

public void remove(K key)

shutdown

public void shutdown()
Stops the listener thread and releases native resources.


create

public V create(K k)

createValue

protected abstract V createValue(K k)


Copyright © 2009. All Rights Reserved.