QueueObjectLookup(DhtReader reader, boolean reportMissing) { this.repo = reader.getRepositoryKey(); this.db = reader.getDatabase(); this.reader = reader; this.options = reader.getOptions(); this.reportMissing = reportMissing; this.tmp = new ArrayList<ObjectInfo>(4); this.context = Context.FAST_MISSING_OK; this.toRetry = new ArrayList<T>(); this.concurrentBatches = options.getObjectIndexConcurrentBatches(); }
QueueObjectLookup(DhtReader reader, boolean reportMissing) { this.repo = reader.getRepositoryKey(); this.db = reader.getDatabase(); this.reader = reader; this.options = reader.getOptions(); this.reportMissing = reportMissing; this.tmp = new ArrayList<ObjectInfo>(4); this.context = Context.FAST_MISSING_OK; this.toRetry = new ArrayList<T>(); this.concurrentBatches = options.getObjectIndexConcurrentBatches(); }
BatchObjectLookup(DhtReader reader, ProgressMonitor monitor) { this.repo = reader.getRepositoryKey(); this.db = reader.getDatabase(); this.reader = reader; if (monitor != null && monitor != NullProgressMonitor.INSTANCE) this.progress = new ThreadSafeProgressMonitor(monitor); else this.progress = null; this.concurrentBatches = reader.getOptions() .getObjectIndexConcurrentBatches(); this.batches = new Semaphore(concurrentBatches); this.resultLock = new ReentrantLock(); this.error = new AtomicReference<DhtException>(); this.retry = new ArrayList<T>(); this.tmp = new ArrayList<ObjectInfo>(4); }
BatchObjectLookup(DhtReader reader, ProgressMonitor monitor) { this.repo = reader.getRepositoryKey(); this.db = reader.getDatabase(); this.reader = reader; if (monitor != null && monitor != NullProgressMonitor.INSTANCE) this.progress = new ThreadSafeProgressMonitor(monitor); else this.progress = null; this.concurrentBatches = reader.getOptions() .getObjectIndexConcurrentBatches(); this.batches = new Semaphore(concurrentBatches); this.resultLock = new ReentrantLock(); this.error = new AtomicReference<DhtException>(); this.retry = new ArrayList<T>(); this.tmp = new ArrayList<ObjectInfo>(4); }
Prefetcher(DhtReader reader, int objectType, int prefetchLimitInBytes) { this.db = reader.getDatabase(); this.stats = reader.getStatistics(); this.objectType = objectType; this.ready = new HashMap<ChunkKey, PackChunk>(); this.status = new HashMap<ChunkKey, Status>(); this.queue = new LinkedList<ChunkKey>(); this.followEdgeHints = reader.getOptions().isPrefetchFollowEdgeHints(); this.averageChunkSize = reader.getInserterOptions().getChunkSize(); this.highWaterMark = prefetchLimitInBytes; int lwm = (highWaterMark / averageChunkSize) - 4; if (lwm <= 0) lwm = (highWaterMark / averageChunkSize) / 2; lowWaterMark = lwm * averageChunkSize; }
Prefetcher(DhtReader reader, int objectType, int prefetchLimitInBytes) { this.db = reader.getDatabase(); this.stats = reader.getStatistics(); this.objectType = objectType; this.ready = new HashMap<ChunkKey, PackChunk>(); this.status = new HashMap<ChunkKey, Status>(); this.queue = new LinkedList<ChunkKey>(); this.followEdgeHints = reader.getOptions().isPrefetchFollowEdgeHints(); this.averageChunkSize = reader.getInserterOptions().getChunkSize(); this.highWaterMark = prefetchLimitInBytes; int lwm = (highWaterMark / averageChunkSize) - 4; if (lwm <= 0) lwm = (highWaterMark / averageChunkSize) / 2; lowWaterMark = lwm * averageChunkSize; }
private void startBatch(Context context) throws InterruptedException, DhtTimeoutException { Timeout to = ctx.getOptions().getTimeout(); if (!metaBatches.tryAcquire(1, to.getTime(), to.getUnit())) throw new DhtTimeoutException(DhtText.get().timeoutChunkMeta); Set<ChunkKey> keys = metaToRead; ctx.getDatabase().chunk().getMeta( context, keys, new MetaLoader(context, keys)); metaToRead = new HashSet<ChunkKey>(); }
private void startBatch(Context context) throws InterruptedException, DhtTimeoutException { Timeout to = ctx.getOptions().getTimeout(); if (!metaBatches.tryAcquire(1, to.getTime(), to.getUnit())) throw new DhtTimeoutException(DhtText.get().timeoutChunkMeta); Set<ChunkKey> keys = metaToRead; ctx.getDatabase().chunk().getMeta( context, keys, new MetaLoader(context, keys)); metaToRead = new HashSet<ChunkKey>(); }