public void flush() { trace("flush (start)", null, null, "n.a."); tileCache.flush(); trace("flush (end)", null, null, "n.a."); }
public void onClick() { TileCache jaiCache = getGeoServer().getGlobal().getJAI().getTileCache(); final long capacityBefore = jaiCache.getMemoryCapacity(); jaiCache.flush(); jaiCache.setMemoryCapacity(0); // to be sure we realease all tiles System.gc(); System.runFinalization(); jaiCache.setMemoryCapacity(capacityBefore); updateModel(); } });
public float getMemoryThreshold() { return tileCache.getMemoryThreshold(); }
jaiCache.setMemoryCapacity(jaiMemory); jaiCache.setMemoryThreshold((float) jai.getMemoryThreshold());
/** * Sets the memory capacity of the default tile cache in megabytes * * @param megabytes the memory capacity in megabytes */ public static void setDefaultTileCacheCapacity(int megabytes) { final TileCache tileCache = JAI.getDefaultInstance().getTileCache(); // JAIJAIJAI tileCache.memoryControl(); tileCache.setMemoryCapacity(megabytes * 1024L * 1024L); Debug.trace("JAI tile cache capacity set to " + tileCache.getMemoryCapacity() + " bytes"); }
@PostConstruct protected void initJai() { TileCache cache = JAI.getDefaultInstance().getTileCache(); cache.setMemoryCapacity(getJaiTileCacheInMb() * MB); log.info("JAI cache size set to " + cache.getMemoryCapacity() / MB + " MB"); }
final long tilecacheSize=super.getTileCacheSize(); baseTC= JAI.createTileCache(); baseTC.setMemoryCapacity(tilecacheSize); baseTC.setMemoryThreshold(0.75f); baseTC.flush(); } catch (Exception e) {
jai.getTileCache().setMemoryCapacity(1024l * 1024 * 1024); jai.getTileCache().flush(); long start = System.currentTimeMillis(); ImageIO.write(op, "TIF", new File("/tmp/ndvi.tif"));
public void setMemoryCapacity(long l) { tileCache.setMemoryCapacity(l); }
sb.append(tileCache.getMemoryCapacity() / (1024 * 1024)); sb.append(" MB\n"); sb.append(tileCache.getMemoryThreshold()); sb.append("\n"); sb.append(tileCache.getTileComparator()); sb.append("\n");
TileCache jaiCache = jaiInfo.getTileCache(); values.put(KEY_JAI_MAX_MEM, formatMemory(jaiCache.getMemoryCapacity())); if(jaiCache instanceof CacheDiagnostics) { values.put(KEY_JAI_MEM_USAGE, formatMemory(((CacheDiagnostics) jaiCache).getCacheMemoryUsed())); values.put(KEY_JAI_MEM_USAGE, "-"); values.put(KEY_JAI_MEM_THRESHOLD, Float.toString(100.0f * jaiCache.getMemoryThreshold())); values.put(KEY_JAI_TILE_THREADS, Integer.toString(jai.getTileScheduler().getParallelism())); values.put(KEY_JAI_TILE_THREAD_PRIORITY, Integer.toString(jai.getTileScheduler()
public long getMemoryCapacity() { return tileCache.getMemoryCapacity(); }
@Override public void dispose() { tilecache.removeTiles(this); if (spi != null && imageReader != null) { imageReader.dispose(); imageReader = null; } }
public void run() { if (!multipleTestOperations) { int i = 0; while (i < maxRequestPerThread) { double dataX = generator.nextDouble(); double dataY = generator.nextDouble(); final int tilex = (int) (dataX * (maxTileX - minTileX) + minTileX); final int tiley = (int) (dataY * (maxTileY - minTileY) + minTileY); image_.getTile(tilex, tiley); i++; } JAI.getDefaultInstance().getTileCache().removeTiles(image_); latch.countDown(); } else { JAI.getDefaultInstance().getTileCache().getTiles(image_); JAI.getDefaultInstance().getTileCache().removeTiles(image_); latch.countDown(); } }
private void initializeJAI() { long tileCacheCapacity = commandLineArgs.getTileCacheCapacity(); int tileSchedulerParallelism = commandLineArgs.getTileSchedulerParallelism(); if (tileCacheCapacity > 0) { JAI.enableDefaultTileCache(); JAI.getDefaultInstance().getTileCache().setMemoryCapacity(tileCacheCapacity); } else { JAI.getDefaultInstance().getTileCache().setMemoryCapacity(0L); JAI.disableDefaultTileCache(); } if (tileSchedulerParallelism > 0) { JAI.getDefaultInstance().getTileScheduler().setParallelism(tileSchedulerParallelism); } final long tileCacheSize = JAI.getDefaultInstance().getTileCache().getMemoryCapacity() / (1024L * 1024L); commandLineContext.getLogger().info(MessageFormat.format("JAI tile cache size is {0} MB", tileCacheSize)); final int schedulerParallelism = JAI.getDefaultInstance().getTileScheduler().getParallelism(); commandLineContext.getLogger().info( MessageFormat.format("JAI tile scheduler parallelism is {0}", schedulerParallelism)); }
private GTRasterDataBinding parseTiff(File file){ JAI.getDefaultInstance().getTileCache().setMemoryCapacity(256*1024*1024); Hints hints = new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE); GeoTiffReader reader; try { reader = new GeoTiffReader(file, hints); GridCoverage2D coverage = (GridCoverage2D) reader.read(null); return new GTRasterDataBinding(coverage); } catch (DataSourceException e) { LOGGER.error(e.getMessage(), e); throw new RuntimeException(e); } catch (IOException e) { LOGGER.error(e.getMessage(), e); throw new RuntimeException(e); } }
sb.append(tileCache.getMemoryCapacity() / (1024 * 1024)); sb.append(" MB\n"); sb.append(tileCache.getMemoryThreshold()); sb.append("\n"); sb.append(tileCache.getTileComparator()); sb.append("\n");
TileCache jaiCache = jaiInfo.getTileCache(); values.put(KEY_JAI_MAX_MEM, formatMemory(jaiCache.getMemoryCapacity())); if (jaiCache instanceof CacheDiagnostics) { values.put( Integer.toString((int) (100.0f * jaiCache.getMemoryThreshold())) + "%"); values.put(KEY_JAI_TILE_THREADS, Integer.toString(jai.getTileScheduler().getParallelism())); values.put(
private static synchronized TileCache getTileCache() { if (tileCache == null) { boolean useFileTileCache = Boolean.parseBoolean( System.getProperty(GPF.USE_FILE_TILE_CACHE_PROPERTY, "false")); if (useFileTileCache) { tileCache = new SwappingTileCache(JAI.getDefaultInstance().getTileCache().getMemoryCapacity(), new DefaultSwapSpace(SwappingTileCache.DEFAULT_SWAP_DIR, BeamLogManager.getSystemLogger())); } else { tileCache = JAI.getDefaultInstance().getTileCache(); } BeamLogManager.getSystemLogger().info( String.format("All GPF operators will share an instance of %s with a capacity of %dM", tileCache.getClass().getName(), tileCache.getMemoryCapacity() / (1024 * 1024))); } return tileCache; }
public void removeTiles(RenderedImage renderedImage) { tileCache.removeTiles(renderedImage); trace("removeTiles", renderedImage, null, "n.a."); }