de.tsl2.nano.collection.TimedReferenceMap Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tsl2.nano.datastructure Show documentation
Show all versions of tsl2.nano.datastructure Show documentation
optimized implementations for trees, collections, arrays, historized input
/*
* File: $HeadURL$
* Id : $Id$
*
* created by: Thomas Schneider
* created on: Oct 23, 2012
*
* Copyright: (c) Thomas Schneider 2012, all rights reserved
*/
package de.tsl2.nano.collection;
/**
* The {@link ReferenceMap} of apache commons is overwritten to add temporarily hard references. If a new object was
* added (to a weak map), but a reference will be created some milliseconds later, the value may be garbage collected
* already. This map holds a collection - the {@link TimedReferences} to don't lose the object to early.
*
* To set the duration of the hard references, call {@link #setTimeToBeOld(long)}, giving the milliseconds to hold an
* object at least.
*
* Only the {@link #put(Object, Object)} method was overridden, {@link #putAll(java.util.Map)} should call this
* {@link #put(Object, Object)} method. Removing values will not change the {@link TimedReferences}!
*
* @author Thomas Schneider
* @version $Revision$
*/
public class TimedReferenceMap extends ReferenceMap