cdm/src/main/java/ucar/nc2/util/cache/FileCacheARC.java
@Override
  public boolean release(FileCacheable ncfile) throws IOException {
    if (ncfile == null) return false;

    if (disabled.get()) {
      ncfile.setFileCache(null); // prevent infinite loops
      ncfile.close();
      return false;
    }

    // find it in the file cache
    int hashcode = System.identityHashCode(ncfile);    // using Object hashCode of the FileCacheable
    CacheElement.CacheFile file = files.get(hashcode);
    if (file != null) {
      if (!file.isLocked.get()) {
        Exception e = new Exception("Stack trace");
        cacheLog.warn("FileCacheARC " + name + " release " + ncfile.getLocation() + " not locked; hash= "+ncfile.hashCode(), e);
      }
      //file.lastAccessed = System.currentTimeMillis();
      //file.countAccessed++;
      file.isLocked.set(false);
      if (cacheLog.isDebugEnabled()) cacheLog.debug("FileCacheARC " + name + " release " + ncfile.getLocation()+"; hash= "+ncfile.hashCode());
      if (debugPrint) System.out.println("  FileCacheARC " + name + " release " + ncfile.getLocation());
      return true;
    }
    return false;
    // throw new IOException("FileCacheARC " + name + " release does not have file in cache = " + ncfile.getLocation());
  }
@Override
  public boolean release(FileCacheable ncfile) throws IOException {
    if (ncfile == null) return false;

    if (disabled.get()) {
      ncfile.setFileCache(null); // prevent infinite loops
      ncfile.close();
      return false;
    }

    // find it in the file cache
    int hashcode = System.identityHashCode(ncfile);    // using Object hashCode of the FileCacheable
    CacheElement.CacheFile file = files.get(hashcode);
    if (file != null) {
      if (!file.isLocked.get()) {
        Exception e = new Exception("Stack trace");
        cacheLog.warn("FileCacheARC " + name + " release " + ncfile.getLocation() + " not locked; hash= "+ncfile.hashCode(), e);
      }
      //file.lastAccessed = System.currentTimeMillis();
      //file.countAccessed++;
      file.isLocked.set(false);
      if (cacheLog.isDebugEnabled()) cacheLog.debug("FileCacheARC " + name + " release " + ncfile.getLocation()+"; hash= "+ncfile.hashCode());
      if (debugPrint) System.out.println("  FileCacheARC " + name + " release " + ncfile.getLocation());
      return true;
    }
    return false;
    // throw new IOException("FileCacheARC " + name + " release does not have file in cache = " + ncfile.getLocation());
  }
@ Override public boolean release ( FileCacheable ncfile ) throws IOException { if ( ncfile == null ) return false ; if ( disabled . get ( ) ) { ncfile . setFileCache ( null ) ; // prevent infinite loops ncfile . close ( ) ; return false ; } // find it in the file cache int hashcode = System . identityHashCode ( ncfile ) ; // using Object hashCode of the FileCacheable CacheElement . CacheFile file = files . get ( hashcode ) ; if ( file != null ) { if ( ! file . isLocked . get ( ) ) { Exception e = new Exception ( "Stack trace" ) ; cacheLog . warn ( "FileCacheARC " + name + " release " + ncfile . getLocation ( ) + " not locked; hash= " + ncfile . hashCode ( ) , e ) ; } //file.lastAccessed = System.currentTimeMillis(); //file.countAccessed++; file . isLocked . set ( false ) ; if ( cacheLog . isDebugEnabled ( ) ) cacheLog . debug ( "FileCacheARC " + name + " release " + ncfile . getLocation ( ) + "; hash= " + ncfile . hashCode ( ) ) ; if ( debugPrint ) System . out . println ( "  FileCacheARC " + name + " release " + ncfile . getLocation ( ) ) ; return true ; } return false ; // throw new IOException("FileCacheARC " + name + " release does not have file in cache = " + ncfile.getLocation()); }
Release the file. This unlocks it, updates its lastAccessed date.
FileCacheable.close() needs to call this instead of actually closing.

@param ncfile release the lock on this FileCacheable object.
@throws IOException if file not in cache.
Release the file . This unlocks it updates its lastAccessed date . FileCacheable . close () needs to call this instead of actually closing .