@Override public void release() { reader.getRecentChunks().setMaxBytes(reader.getOptions().getChunkLimit()); prefetcher = null; currChunk = null; }
@Override public void release() { reader.getRecentChunks().setMaxBytes(reader.getOptions().getChunkLimit()); prefetcher = null; currChunk = null; }
private void init() throws IOException { ObjectWithInfo<T> c; while ((c = nextObjectWithInfo()) != null) { ChunkKey chunkKey = c.chunkKey; Collection<ObjectWithInfo<T>> list = byChunk.get(chunkKey); if (list == null) { list = new ArrayList<ObjectWithInfo<T>>(); byChunk.put(chunkKey, list); if (prefetcher == null) { int limit = reader.getOptions().getChunkLimit(); int ratio = reader.getOptions().getOpenQueuePrefetchRatio(); int prefetchLimit = (int) (limit * (ratio / 100.0)); reader.getRecentChunks().setMaxBytes(limit - prefetchLimit); prefetcher = new Prefetcher(reader, 0, prefetchLimit); } prefetcher.push(chunkKey); } list.add(c); } chunkItr = byChunk.values().iterator(); } }
private void init() throws IOException { ObjectWithInfo<T> c; while ((c = nextObjectWithInfo()) != null) { ChunkKey chunkKey = c.chunkKey; Collection<ObjectWithInfo<T>> list = byChunk.get(chunkKey); if (list == null) { list = new ArrayList<ObjectWithInfo<T>>(); byChunk.put(chunkKey, list); if (prefetcher == null) { int limit = reader.getOptions().getChunkLimit(); int ratio = reader.getOptions().getOpenQueuePrefetchRatio(); int prefetchLimit = (int) (limit * (ratio / 100.0)); reader.getRecentChunks().setMaxBytes(limit - prefetchLimit); prefetcher = new Prefetcher(reader, 0, prefetchLimit); } prefetcher.push(chunkKey); } list.add(c); } chunkItr = byChunk.values().iterator(); } }
void copyAsIs(PackOutputStream out, boolean validate, DhtReader ctx) throws IOException { if (keyList == null) init(); // Clear the recent chunks because all of the reader's // chunk limit should be made available for prefetch. int cacheLimit = ctx.getOptions().getChunkLimit(); ctx.getRecentChunks().setMaxBytes(0); try { Prefetcher p = new Prefetcher(ctx, 0, cacheLimit); p.push(Arrays.asList(keyList)); copyPack(out, p, validate); } finally { ctx.getRecentChunks().setMaxBytes(cacheLimit); } }
void copyAsIs(PackOutputStream out, boolean validate, DhtReader ctx) throws IOException { if (keyList == null) init(); // Clear the recent chunks because all of the reader's // chunk limit should be made available for prefetch. int cacheLimit = ctx.getOptions().getChunkLimit(); ctx.getRecentChunks().setMaxBytes(0); try { Prefetcher p = new Prefetcher(ctx, 0, cacheLimit); p.push(Arrays.asList(keyList)); copyPack(out, p, validate); } finally { ctx.getRecentChunks().setMaxBytes(cacheLimit); } }