public String toString() { return isLocked + " " + ncfile.getLocation(); }
String getCacheName() { return ncfile.getLocation(); }
public String toString() { return isLocked + " " + ncfile.getLocation(); }
String getCacheName() { return ncfile.getLocation(); }
String getCacheName() { return ncfile.getLocation(); }
void remove() { synchronized (CacheElement.this) { if (!list.remove(this)) cacheLog.warn("FileCache " + name + " could not remove " + ncfile.getLocation()); } if (cacheLog.isDebugEnabled()) cacheLog.debug("FileCache " + name + " remove " + ncfile.getLocation()); if (debugPrint) System.out.printf(" FileCache %s remove %s%n", name, ncfile.getLocation()); }
public String toString() { return isLocked + " " + countAccessed + " " + new Date(lastAccessed) + " " + ncfile.getLocation(); }
void remove() { synchronized (CacheElement.this) { if (!list.remove(this)) cacheLog.warn("FileCache " + name + " could not remove " + ncfile.getLocation()); } if (cacheLog.isDebugEnabled()) cacheLog.debug("FileCache " + name + " remove " + ncfile.getLocation()); if (debugPrint) System.out.println(" FileCache " + name + " remove " + ncfile.getLocation()); }
void remove() { synchronized (CacheElement.this) { if (!list.remove(this)) cacheLog.warn("FileCache " + name + " could not remove " + ncfile.getLocation()); } if (cacheLog.isDebugEnabled()) cacheLog.debug("FileCache " + name + " remove " + ncfile.getLocation()); if (debugPrint) System.out.println(" FileCache " + name + " remove " + ncfile.getLocation()); }
void remove() { int hashcode = System.identityHashCode(ncfile); // using Object hashCode of the FileCacheable if (null == files.remove(hashcode)) cacheLog.warn("FileCacheARC {} could not remove {} from files", name, ncfile.getLocation()); if (!list.remove(this)) cacheLog.warn("FileCacheARC {} could not remove {} from list", name, ncfile.getLocation()); close(); }
void remove() { int hashcode = System.identityHashCode(ncfile); // using Object hashCode of the FileCacheable if (null == files.remove(hashcode)) cacheLog.warn("FileCacheARC {} could not remove {} from files", name, ncfile.getLocation()); if (!list.remove(this)) cacheLog.warn("FileCacheARC {} could not remove {} from list", name, ncfile.getLocation()); close(); }
void close() { // really close the file ncfile.setFileCache(null); try { ncfile.close(); } catch (IOException e) { log.error("close failed on "+ncfile.getLocation(), e); } if (cacheLog.isDebugEnabled()) cacheLog.debug("FileCacheARC " + name + " remove " + ncfile.getLocation()); if (debugPrint) System.out.println(" FileCacheARC " + name + " remove " + ncfile.getLocation()); ncfile = null; }
void close() { // really close the file ncfile.setFileCache(null); try { ncfile.close(); } catch (IOException e) { log.error("close failed on "+ncfile.getLocation(), e); } if (cacheLog.isDebugEnabled()) cacheLog.debug("FileCacheARC " + name + " remove " + ncfile.getLocation()); if (debugPrint) System.out.println(" FileCacheARC " + name + " remove " + ncfile.getLocation()); ncfile = null; }
public String toString() { String name = ncfile == null ? "ncfile is null" : ncfile.getLocation(); return isLocked + " " + countAccessed + " " + CalendarDateFormatter.toDateTimeStringISO(lastAccessed) + " " + name; }
public String toString() { return isLocked + " " + countAccessed + " " + CalendarDateFormatter.toDateTimeStringISO(lastAccessed) + " " + ncfile.getLocation(); }
/** * Show individual cache entries, add to formatter. * * @param format add to this */ public void showCache(Formatter format) { ArrayList<CacheElement.CacheFile> allFiles = new ArrayList<CacheElement.CacheFile>(files.size()); for (CacheElement elem : cache.values()) { synchronized (elem) { allFiles.addAll(elem.list); } } Collections.sort(allFiles); // sort so oldest are on top format.format("FileCache %s (%d):%n", name, allFiles.size()); format.format("isLocked accesses lastAccess location %n"); for (CacheElement.CacheFile file : allFiles) { String loc = file.ncfile != null ? file.ncfile.getLocation() : "null"; format.format("%8s %9d %s %s %n", file.isLocked, file.countAccessed, new Date(file.lastAccessed), loc); } }
/** * Show individual cache entries, add to formatter. * * @param format add to this */ @Override public void showCache(Formatter format) { ArrayList<CacheElement.CacheFile> allFiles = new ArrayList<>(files.size()); for (CacheElement elem : cache.values()) { synchronized (elem) { allFiles.addAll(elem.list); } } Collections.sort(allFiles); // sort so oldest are on top format.format("%nFileCache %s (min=%d softLimit=%d hardLimit=%d scour=%d):%n", name, minElements, softLimit, hardLimit, period); format.format(" isLocked accesses lastAccess location %n"); for (CacheElement.CacheFile file : allFiles) { String loc = file.ncfile != null ? file.ncfile.getLocation() : "null"; format.format("%8s %9d %s == %s %n", file.isLocked, file.countAccessed, CalendarDateFormatter.toDateTimeStringISO(file.lastAccessed), loc); } showStats(format); }
/** * Show individual cache entries, add to formatter. * * @param format add to this */ @Override public void showCache(Formatter format) { ArrayList<CacheElement.CacheFile> allFiles = new ArrayList<>(files.size()); for (CacheElement elem : cache.values()) { synchronized (elem) { allFiles.addAll(elem.list); } } Collections.sort(allFiles); // sort so oldest are on top format.format("%nFileCache %s (min=%d softLimit=%d hardLimit=%d scour=%d secs):%n", name, minElements, softLimit, hardLimit, period/1000); format.format(" isLocked accesses lastAccess location %n"); for (CacheElement.CacheFile file : allFiles) { String loc = file.ncfile != null ? file.ncfile.getLocation() : "null"; format.format("%8s %9d %s == %s %n", file.isLocked, file.countAccessed, CalendarDateFormatter.toDateTimeStringISO(file.lastAccessed), loc); } showStats(format); }
private void remove(CacheElement.CacheFile want) { want.remove(); files.remove(want.ncfile); try { want.ncfile.setFileCache(null); // unhook the caching want.ncfile.close(); } catch (IOException e) { log.error("close failed on "+want.ncfile.getLocation(), e); } want.ncfile = null; }
void checkAllSame(List<FileCache.CacheElement.CacheFile> list) { FileCache.CacheElement.CacheFile first = null; for (FileCache.CacheElement.CacheFile file : list) { Assert.assertTrue(file.isLocked.get()); Assert.assertEquals(0, file.countAccessed); // countAccessed not incremented until its closed, so == 0 Assert.assertNotEquals(0, file.lastAccessed); if (first == null) first = file; else { assert first.ncfile.getLocation().equals(file.ncfile.getLocation()); assert first.lastAccessed < file.lastAccessed; } } }