Package ucar.nc2.util.cache
Interface FileCacheable
-
- All Known Subinterfaces:
FeatureDataset
,FeatureDatasetPoint
,GridDataset
,RadialDatasetSweep
,StationRadialDataset
,StationRadialDataset
- All Known Implementing Classes:
AbstractRadialAdapter
,CdmRemote
,CFRadialAdapter
,DapNetcdfFile
,DODSNetcdfFile
,Dorade2RadialAdapter
,FeatureDatasetCoverage
,FeatureDatasetImpl
,Grib1Collection
,Grib1Partition
,Grib2Collection
,Grib2Partition
,GribCollectionImmutable
,GridDataset
,HTTPRandomAccessFile
,InMemoryRandomAccessFile
,MMapRandomAccessFile
,NetcdfDataset
,NetcdfFile
,NetcdfFileSubclass
,NetcdfFileWriteable
,Nexrad2RadialAdapter
,NidsRadialAdapter
,NsslRadialAdapter
,PartitionCollectionImmutable
,PointDatasetImpl
,PointDatasetRemote
,RandomAccessDirectory
,RandomAccessFile
,RemoteRandomAccessFile
,S3RandomAccessFile
,SimpleGeometryFeatureDataset
,UF2RadialAdapter
public interface FileCacheable
Interface for files that can be stored in FileCache. Requirements: 1. hashCode() must return Object.hashCode() 2. close() must call cache.release(this) if cache is not null. 3. must be able to detect changes in underlying object, and indicate whether it has changed. THIS IS AN INTERNAL CLASS, DO NOT USE DIRECTLY.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Close the FileCacheable, release all resources.long
getLastModified()
Returns the time that the underlying file(s) were last modified.String
getLocation()
The location of the FileCacheable.void
reacquire()
Reacquire any resources like file handles Used when reactivating in cache.void
release()
Release any system resources like file handles.void
setFileCache(FileCacheIF fileCache)
If the FileCache is not null, FileCacheable.close() must call FileCache.release()
-
-
-
Method Detail
-
getLocation
String getLocation()
The location of the FileCacheable. This must be sufficient for FileFactory.factory() to create the FileCacheable object- Returns:
- location
-
close
void close() throws IOException
Close the FileCacheable, release all resources. Must call cache.release(this) if cache is not null.- Throws:
IOException
- on io error
-
getLastModified
long getLastModified()
Returns the time that the underlying file(s) were last modified. If they've changed since they were stored in the cache, they will be closed and reopened withFileFactory
.- Returns:
- a
long
value representing the time the file(s) were last modified or0L
if the last-modified time couldn't be determined for any reason.
-
setFileCache
void setFileCache(FileCacheIF fileCache)
If the FileCache is not null, FileCacheable.close() must call FileCache.release()public synchronized void close() throws java.io.IOException { if (cache != null) { if (cache.release(this)) return; } reallyClose(); }
- Parameters:
fileCache
- must store this, use it on close as above.
-
release
void release() throws IOException
Release any system resources like file handles. Optional, implement only if you are able to reacquire. Used when object is made inactive in cache.- Throws:
IOException
-
reacquire
void reacquire() throws IOException
Reacquire any resources like file handles Used when reactivating in cache.- Throws:
IOException
-
-