public void onSuccess(Map<CacheKey, byte[]> result) { if (result != null && !result.isEmpty()) onPartialResult(result); synchronized (lock) { if (remaining.isEmpty() || options == Context.FAST_MISSING_OK) { normalCallback.onSuccess(all); } else { db.getMeta(options, remaining, new MetaFromDatabase(all, normalCallback, streamingCallback)); } } }
public void onPartialResult(Map<ChunkKey, ChunkMeta> result) { final Map<ChunkKey, ChunkMeta> toPutIntoCache = copy(result); if (streamingCallback != null) streamingCallback.onPartialResult(result); else { synchronized (lock) { all.putAll(result); } } // Encoding is rather expensive, so move the cache population // into it a different background thread to prevent the current // database task from being starved of time. // executor.submit(new Runnable() { public void run() { for (Map.Entry<ChunkKey, ChunkMeta> ent : toPutIntoCache.entrySet()) { ChunkKey key = ent.getKey(); Change op = Change.put(nsMeta.key(key), ent.getValue().toByteArray()); client.modify(singleton(op), none); } } }); }
public void onPartialResult(Map<ChunkKey, ChunkMeta> result) { final Map<ChunkKey, ChunkMeta> toPutIntoCache = copy(result); if (streamingCallback != null) streamingCallback.onPartialResult(result); else { synchronized (lock) { all.putAll(result); } } // Encoding is rather expensive, so move the cache population // into it a different background thread to prevent the current // database task from being starved of time. // executor.submit(new Runnable() { public void run() { for (Map.Entry<ChunkKey, ChunkMeta> ent : toPutIntoCache.entrySet()) { ChunkKey key = ent.getKey(); Change op = Change.put(nsMeta.key(key), ent.getValue().toByteArray()); client.modify(singleton(op), none); } } }); }
public void onSuccess(Map<ChunkKey, ChunkMeta> result) { if (result != null && !result.isEmpty()) onPartialResult(result); synchronized (lock) { normalCallback.onSuccess(all); } }
public void onSuccess(Map<CacheKey, byte[]> result) { if (result != null && !result.isEmpty()) onPartialResult(result); synchronized (lock) { if (remaining.isEmpty() || options == Context.FAST_MISSING_OK) { normalCallback.onSuccess(all); } else { db.getMeta(options, remaining, new MetaFromDatabase(all, normalCallback, streamingCallback)); } } }
public void onSuccess(Map<ChunkKey, ChunkMeta> result) { if (result != null && !result.isEmpty()) onPartialResult(result); synchronized (lock) { normalCallback.onSuccess(all); } }