void push(Iterable<ChunkKey> list) { synchronized (this) { for (ChunkKey key : list) { if (status.containsKey(key)) continue; status.put(key, Status.ON_QUEUE); queue.add(key); if (key.equals(stopAt)) { automaticallyPushHints = false; break; } } if (!first) maybeStartGet(); } }
void push(Iterable<ChunkKey> list) { synchronized (this) { for (ChunkKey key : list) { if (status.containsKey(key)) continue; status.put(key, Status.ON_QUEUE); queue.add(key); if (key.equals(stopAt)) { automaticallyPushHints = false; break; } } if (!first) maybeStartGet(); } }
private void forceStartGet() { // Use a LinkedHashSet so insertion order is iteration order. // This may help a provider that loads sequentially in the // set's iterator order to load in the order we want data. // LinkedHashSet<ChunkKey> toLoad = new LinkedHashSet<ChunkKey>(); while (bytesReady + bytesLoading < highWaterMark && !queue.isEmpty()) { ChunkKey key = queue.removeFirst(); stats.access(key).cntPrefetcher_Load++; toLoad.add(key); status.put(key, Status.LOADING); bytesLoading += averageChunkSize; // For the first chunk, start immediately to reduce the // startup latency associated with additional chunks. if (first) break; } if (!toLoad.isEmpty() && error == null) db.chunk().get(Context.LOCAL, toLoad, this); if (first) { first = false; maybeStartGet(); } }
private void forceStartGet() { // Use a LinkedHashSet so insertion order is iteration order. // This may help a provider that loads sequentially in the // set's iterator order to load in the order we want data. // LinkedHashSet<ChunkKey> toLoad = new LinkedHashSet<ChunkKey>(); while (bytesReady + bytesLoading < highWaterMark && !queue.isEmpty()) { ChunkKey key = queue.removeFirst(); stats.access(key).cntPrefetcher_Load++; toLoad.add(key); status.put(key, Status.LOADING); bytesLoading += averageChunkSize; // For the first chunk, start immediately to reduce the // startup latency associated with additional chunks. if (first) break; } if (!toLoad.isEmpty() && error == null) db.chunk().get(Context.LOCAL, toLoad, this); if (first) { first = false; maybeStartGet(); } }
private PackChunk useReadyChunk(ChunkKey key) { PackChunk chunk = ready.remove(key); status.put(chunk.getChunkKey(), Status.DONE); bytesReady -= chunk.getTotalSize(); if (automaticallyPushHints) { push(chunk.getMeta()); maybeStartGet(); } return chunk; }
private PackChunk useReadyChunk(ChunkKey key) { PackChunk chunk = ready.remove(key); status.put(chunk.getChunkKey(), Status.DONE); bytesReady -= chunk.getTotalSize(); if (automaticallyPushHints) { push(chunk.getMeta()); maybeStartGet(); } return chunk; }
stopAt = endKey; push(startKey); maybeStartGet();
stopAt = endKey; push(startKey); maybeStartGet();