/** * Advises the cache that all of its tiles may be discarded. It * is legal to implement this method as a no-op. */ public synchronized void flush() { TileId[] tileIds; tileIds = tileMap.keySet().toArray(new TileId[tileMap.size()]); for (TileId tileId : tileIds) { removeTile(tileId); } tileMap.clear(); idMap.clear(); }
/** * Advises the cache that a tile is no longer needed. It is legal * to implement this method as a no-op. * * @param owner The <code>RenderedImage</code> that the tile belongs to. * @param tileX The X index of the tile in the owner's tile grid. * @param tileY The Y index of the tile in the owner's tile grid. */ public void remove(RenderedImage owner, int tileX, int tileY) { removeTile(createTileId(owner, tileX, tileY)); }
/** * Advises the cache that some of its tiles may be discarded. It * is legal to implement this method as a no-op. * * @since JAI 1.1 */ public synchronized void memoryControl() { CachedTileImpl[] tiles = tileMap.values().toArray(new CachedTileImpl[tileMap.size()]); Arrays.sort(tiles, createTileComparator()); for (CachedTileImpl tile : tiles) { if (memoryInUse <= memoryThreshold * memoryCapacity) { break; } removeTile(tile.tileId); } }