Class ComputationRunner
java.lang.Object
org.nuxeo.lib.stream.computation.log.ComputationRunner
- All Implemented Interfaces:
Runnable,RebalanceListener
Thread driving a Computation
- Since:
- 9.3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classprotected static enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CountDownLatchprotected static final intprotected static final intprotected Computationprotected ComputationContextImplprotected longprotected List<LogPartition> protected booleanprotected io.dropwizard.metrics5.Counterstatic final Stringprotected io.dropwizard.metrics5.Counterprotected static final longprotected longprotected longprotected longprotected io.opencensus.trace.SpanContextprotected longprotected final WatermarkMonotonicIntervalprotected final ComputationMetadataMappingstatic final Stringprotected longprotected final ComputationPolicyprotected io.dropwizard.metrics5.Timerprotected io.dropwizard.metrics5.Timerstatic final Durationprotected Durationprotected booleanprotected io.dropwizard.metrics5.Counterprotected final io.dropwizard.metrics5.MetricRegistryprotected io.dropwizard.metrics5.Counterprotected static AtomicIntegerstatic final longprotected static final longprotected booleanprotected final LogStreamManagerprotected final Supplier<Computation> protected String -
Constructor Summary
ConstructorsConstructorDescriptionComputationRunner(Supplier<Computation> supplier, ComputationMetadataMapping metadata, List<LogPartition> defaultAssignment, LogStreamManager streamManager, ComputationPolicy policy) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidprotected voidcheckRecordFlags(Record record) protected voidprotected voidprotected booleanvoiddrain()Gets the tailer read duration.protected io.opencensus.trace.SpangetSpanFromRecord(Record record) protected DurationDeprecated, for removal: This API element is subject to removal in a future version.voidonPartitionsAssigned(Collection<LogPartition> partitions) voidonPartitionsRevoked(Collection<LogPartition> partitions) protected voidprocessFallback(ComputationContextImpl context) protected voidprotected booleanprotected voidprocessRecordWithRetry(String from, Record record) protected voidprocessRecordWithTracing(String from, Record record) protected booleanprotected voidprocessTimerWithRetry(String key, Long value) protected booleanprocessTimerWithTracing(long now, LinkedHashMap<String, Long> sortedTimer) protected voidprocessWithRetry(net.jodah.failsafe.function.CheckedRunnable runnable) protected voidvoidrun()protected ComputationRunner.ReturnCoderunOnce()protected voidprotected voidprotected voidprotected voidvoidsetReadTimeout(Duration timeout) Sets tailer read duration.protected voidsetThreadName(String message) protected booleanvoidstop()booleanwaitForAssignments(Duration timeout) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.nuxeo.lib.stream.log.RebalanceListener
onPartitionsLost
-
Field Details
-
READ_TIMEOUT
-
STARVING_TIMEOUT_MS
protected static final long STARVING_TIMEOUT_MS- See Also:
-
INACTIVITY_BREAK_MS
protected static final long INACTIVITY_BREAK_MS- See Also:
-
CHECKPOINT_MAX_RETRY
protected static final int CHECKPOINT_MAX_RETRY- See Also:
-
CHECKPOINT_PAUSE_MS
protected static final int CHECKPOINT_PAUSE_MS- See Also:
-
SLOW_COMPUTATION_THRESHOLD_NS
public static final long SLOW_COMPUTATION_THRESHOLD_NS- See Also:
-
streamManager
-
metadata
-
tailer
-
supplier
-
assignmentLatch
-
lowWatermark
-
policy
-
context
-
stop
protected volatile boolean stop -
drain
protected volatile boolean drain -
computation
-
counter
protected long counter -
inRecords
protected long inRecords -
inCheckpointRecords
protected long inCheckpointRecords -
outRecords
protected long outRecords -
lastReadTime
protected long lastReadTime -
lastTimerExecution
protected long lastTimerExecution -
readTimeout
-
threadName
-
defaultAssignment
-
NUXEO_METRICS_REGISTRY_NAME
- See Also:
-
GLOBAL_FAILURE_COUNT_REGISTRY_NAME
-
registry
protected final io.dropwizard.metrics5.MetricRegistry registry -
globalFailureCount
protected io.dropwizard.metrics5.Counter globalFailureCount -
failureCount
protected io.dropwizard.metrics5.Counter failureCount -
recordSkippedCount
protected io.dropwizard.metrics5.Counter recordSkippedCount -
runningCount
protected io.dropwizard.metrics5.Counter runningCount -
processRecordTimer
protected io.dropwizard.metrics5.Timer processRecordTimer -
processTimerTimer
protected io.dropwizard.metrics5.Timer processTimerTimer -
skipFailures
-
recordActivity
protected boolean recordActivity -
lastSpanContext
protected io.opencensus.trace.SpanContext lastSpanContext
-
-
Constructor Details
-
ComputationRunner
public ComputationRunner(Supplier<Computation> supplier, ComputationMetadataMapping metadata, List<LogPartition> defaultAssignment, LogStreamManager streamManager, ComputationPolicy policy)
-
-
Method Details
-
stop
public void stop() -
drain
public void drain() -
waitForAssignments
- Throws:
InterruptedException
-
run
public void run() -
runOnce
-
registerMetrics
protected void registerMetrics() -
closeTailer
protected void closeTailer() -
processLoop
- Throws:
InterruptedException
-
continueLoop
protected boolean continueLoop() -
processTimer
protected boolean processTimer() -
processTimerWithTracing
-
processTimerWithRetry
-
processWithRetry
protected void processWithRetry(net.jodah.failsafe.function.CheckedRunnable runnable) -
processRecord
- Throws:
InterruptedException
-
processRecordWithTracing
-
getSpanFromRecord
-
processRecordWithRetry
-
processFallback
-
skipFailureForRecovery
protected boolean skipFailureForRecovery() -
getTimeoutDuration
Deprecated, for removal: This API element is subject to removal in a future version.since 2025.5, usegetReadTimeout()instead -
setReadTimeout
Sets tailer read duration.- Since:
- 2025.5
-
getReadTimeout
Gets the tailer read duration.- Since:
- 2025.5
-
checkSourceLowWatermark
protected void checkSourceLowWatermark() -
checkRecordFlags
-
checkpointIfNecessary
protected void checkpointIfNecessary() -
checkpoint
protected void checkpoint() -
saveTimers
protected void saveTimers() -
saveState
protected void saveState() -
saveOffsets
protected void saveOffsets() -
sendRecords
protected void sendRecords() -
getLowWatermark
-
setThreadName
-
onPartitionsRevoked
- Specified by:
onPartitionsRevokedin interfaceRebalanceListener
-
onPartitionsAssigned
- Specified by:
onPartitionsAssignedin interfaceRebalanceListener
-
getReadTimeout()instead