org.deduced
Class AbstractPropertyCollection.CollectionToDeleteMonitor

java.lang.Object
  extended by org.deduced.AbstractPropertyCollection.CollectionToDeleteMonitor
Enclosing class:
AbstractPropertyCollection<K,V>

public static class AbstractPropertyCollection.CollectionToDeleteMonitor
extends java.lang.Object

Collection To Delete Monitor

Author:
Steve McDuff

Field Summary
private static java.util.logging.Level CHECK_DELETE_LOG_LEVEL
          Log level at which delete validation is done.
private  java.util.IdentityHashMap<PropertyCollection<?,?>,PropertyCollection<?,?>> collectionToDeleteList
          This list is used to prevent memory leaks during application development.
private  AbstractPropertyCollection.CheckParent parentCheckRunner
          Instanced invoked by Swing to review the list of collections that should be deleted
 
Constructor Summary
AbstractPropertyCollection.CollectionToDeleteMonitor()
           
 
Method Summary
 void addCollectionToDelete(PropertyCollection<?,?> removedCollection)
          Adds a collection that was recently removed from it's parent to the list of collections that should either get a new parent or be deleted.
 void clear()
          clear the list of collection to delete
 void deleteProcessCompletedValidation(PropertyCollection<?,?> collection)
          last step of the delete process where the collection is identified as properly deleted.
 void flushCollectionsWithNewParent(boolean throwException)
          check if all the collections flagged for deletion have been deleted correctly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHECK_DELETE_LOG_LEVEL

private static final java.util.logging.Level CHECK_DELETE_LOG_LEVEL
Log level at which delete validation is done. This value is only useful if LOG_CHECK_DELETE_ON_CLEAR_PARENT and CHECK_DELETE_ON_CLEAR_PARENT are set to true.


parentCheckRunner

private final AbstractPropertyCollection.CheckParent parentCheckRunner
Instanced invoked by Swing to review the list of collections that should be deleted


collectionToDeleteList

private final java.util.IdentityHashMap<PropertyCollection<?,?>,PropertyCollection<?,?>> collectionToDeleteList
This list is used to prevent memory leaks during application development. It stores a list of all the collections that were removed from their parent. If the collection isn't added to a new parent, the collection is considered lost and should be deleted. In order to be done in a nice way and ensure the memory is freed up, the collection should be deleted.

Constructor Detail

AbstractPropertyCollection.CollectionToDeleteMonitor

public AbstractPropertyCollection.CollectionToDeleteMonitor()
Method Detail

addCollectionToDelete

public void addCollectionToDelete(PropertyCollection<?,?> removedCollection)
Adds a collection that was recently removed from it's parent to the list of collections that should either get a new parent or be deleted.

Parameters:
removedCollection - the removed collection

flushCollectionsWithNewParent

public void flushCollectionsWithNewParent(boolean throwException)
check if all the collections flagged for deletion have been deleted correctly. If they aren't, an assertion error is generated. Developers can also set the flag to throw exceptions.

Parameters:
throwException - if set to true, an exception will be thrown when there are collections that haven't been deleted.

clear

public void clear()
clear the list of collection to delete


deleteProcessCompletedValidation

public void deleteProcessCompletedValidation(PropertyCollection<?,?> collection)
last step of the delete process where the collection is identified as properly deleted.

Parameters:
collection - the collection that is now deleted