/** * @param checkerScope The scope that the limit is being checked from. The time limit is always * checked against {@link System#currentTimeMillis()} * @return true when the limit is enforceable from the checker's scope and it has been reached */ boolean checkTimeLimit(LimitScope checkerScope) { return hasTimeLimit(checkerScope) && (returnImmediately || System.currentTimeMillis() >= limits.getTime()); }
long getTimeLimit() { return limits.getTime(); }
int getBatchLimit() { return limits.getBatch(); }
/** * Set all fields together. * @param batch * @param sizeScope * @param size */ void setFields(int batch, LimitScope sizeScope, long size, LimitScope timeScope, long time) { setBatch(batch); setSizeScope(sizeScope); setSize(size); setTimeScope(timeScope); setTime(time); }
void setBatchProgress(int batchProgress) { progress.setBatch(batchProgress); }
long getTimeProgress() { return progress.getTime(); }
int getBatchProgress() { return progress.getBatch(); }
public Builder setBatchLimit(int batchLimit) { limits.setBatch(batchLimit); return this; }
/** * @param checkerScope * @return true if the size limit can be enforced in the checker's scope */ boolean hasSizeLimit(LimitScope checkerScope) { return limits.canEnforceSizeLimitFromScope(checkerScope) && limits.getSize() > 0; }
/** * @param checkerScope The scope that the limit is being checked from * @return true when the limit is enforceable from the checker's scope and it has been reached */ boolean checkBatchLimit(LimitScope checkerScope) { return hasBatchLimit(checkerScope) && progress.getBatch() >= limits.getBatch(); }
void copy(LimitFields limitsToCopy) { if (limitsToCopy != null) { setFields(limitsToCopy.getBatch(), limitsToCopy.getSizeScope(), limitsToCopy.getSize(), limitsToCopy.getTimeScope(), limitsToCopy.getTime()); } }
/** * @param checkerScope * @return true if the time limit can be enforced in the checker's scope */ boolean hasTimeLimit(LimitScope checkerScope) { return limits.canEnforceTimeLimitFromScope(checkerScope) && limits.getTime() > 0; }
ScannerContext(boolean keepProgress, LimitFields limitsToCopy, boolean trackMetrics) { this.limits = new LimitFields(); if (limitsToCopy != null) this.limits.copy(limitsToCopy); // Progress fields are initialized to 0 progress = new LimitFields(0, LimitFields.DEFAULT_SCOPE, 0, LimitFields.DEFAULT_SCOPE, 0); this.keepProgress = keepProgress; this.scannerState = DEFAULT_STATE; this.metrics = trackMetrics ? new ServerSideScanMetrics() : null; }
/** * @param checkerScope The scope that the limit is being checked from. The time limit is always * checked against {@link System#currentTimeMillis()} * @return true when the limit is enforceable from the checker's scope and it has been reached */ boolean checkTimeLimit(LimitScope checkerScope) { return hasTimeLimit(checkerScope) && progress.getTime() >= limits.getTime(); }
/** * @param checkerScope * @return true if the batch limit can be enforced in the checker's scope */ boolean hasBatchLimit(LimitScope checkerScope) { return limits.canEnforceBatchLimitFromScope(checkerScope) && limits.getBatch() > 0; }
int getBatchLimit() { return limits.getBatch(); }
public Builder setBatchLimit(int batchLimit) { limits.setBatch(batchLimit); return this; }
long getTimeLimit() { return limits.getTime(); }
/** * Set all fields together. */ void setFields(int batch, LimitScope sizeScope, long dataSize, long heapSize, LimitScope timeScope, long time) { setBatch(batch); setSizeScope(sizeScope); setDataSize(dataSize); setHeapSize(heapSize); setTimeScope(timeScope); setTime(time); }