org.geotools.coverage
Class CoverageCache

java.lang.Object
  extended byorg.geotools.coverage.CoverageCache

public class CoverageCache
extends java.lang.Object

A cache for coverage instances. Call to reference(org.opengis.coverage.Coverage) method returns a weak or soft reference to the specified coverage. If such a reference previously existed, it is returned. Otherwise a new reference is created.

Since:
2.1
Version:
$Id: CoverageCache.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux
To Do:
This is just a first draft. The goal is to create soft reference, and transform automatically soft reference into weak ones once some amount of memory usage is reached. Do not rely on this API; it may change again.

Field Summary
static CoverageCache DEFAULT
          The default, system-wide cache for coverages.
 
Constructor Summary
CoverageCache()
          Creates a new coverage cache.
 
Method Summary
protected  void finalize()
          Cleanup this coverage cache on garbage collection.
 java.lang.ref.Reference reference(org.opengis.coverage.Coverage coverage)
          Returns a reference to the specified coverage.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT

public static final CoverageCache DEFAULT
The default, system-wide cache for coverages.

Constructor Detail

CoverageCache

public CoverageCache()
Creates a new coverage cache.

Method Detail

reference

public java.lang.ref.Reference reference(org.opengis.coverage.Coverage coverage)
Returns a reference to the specified coverage. If weak or soft reference already exists for the specified coverage, then this reference is returned. Otherwise, a weak reference is created and returned.

Parameters:
coverage - The coverage to reference.
Returns:
A weak of a soft reference to the specified coverage.

finalize

protected void finalize()
                 throws java.lang.Throwable
Cleanup this coverage cache on garbage collection.

Throws:
java.lang.Throwable


Copyright © GeoTools. All Rights Reserved.