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
Modifier and TypeClassDescriptionprotected static class
protected static enum
-
Field Summary
Modifier and TypeFieldDescriptionprotected final CountDownLatch
protected static final int
protected static final int
protected Computation
protected ComputationContextImpl
protected long
protected List<LogPartition>
protected boolean
protected io.dropwizard.metrics5.Counter
static final String
protected io.dropwizard.metrics5.Counter
protected static final long
protected long
protected long
protected long
protected io.opencensus.trace.SpanContext
protected long
protected final WatermarkMonotonicInterval
protected final ComputationMetadataMapping
static final String
protected long
protected final ComputationPolicy
protected io.dropwizard.metrics5.Timer
protected io.dropwizard.metrics5.Timer
static final Duration
protected boolean
protected io.dropwizard.metrics5.Counter
protected final io.dropwizard.metrics5.MetricRegistry
protected io.dropwizard.metrics5.Counter
protected static AtomicInteger
static final long
protected static final long
protected boolean
protected final LogStreamManager
protected final Supplier<Computation>
protected String
-
Constructor Summary
ConstructorDescriptionComputationRunner
(Supplier<Computation> supplier, ComputationMetadataMapping metadata, List<LogPartition> defaultAssignment, LogStreamManager streamManager, ComputationPolicy policy) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
protected void
checkRecordFlags
(Record record) protected void
protected void
protected boolean
void
drain()
protected io.opencensus.trace.Span
getSpanFromRecord
(Record record) protected Duration
void
onPartitionsAssigned
(Collection<LogPartition> partitions) void
onPartitionsRevoked
(Collection<LogPartition> partitions) protected void
processFallback
(ComputationContextImpl context) protected void
protected boolean
protected void
processRecordWithRetry
(String from, Record record) protected void
processRecordWithTracing
(String from, Record record) protected boolean
protected void
processTimerWithRetry
(String key, Long value) protected boolean
processTimerWithTracing
(long now, LinkedHashMap<String, Long> sortedTimer) protected void
processWithRetry
(net.jodah.failsafe.function.CheckedRunnable runnable) protected void
void
run()
protected ComputationRunner.ReturnCode
runOnce()
protected void
protected void
protected void
protected void
protected void
setThreadName
(String message) protected boolean
void
stop()
boolean
waitForAssignments
(Duration timeout) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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 -
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
-
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:
onPartitionsRevoked
in interfaceRebalanceListener
-
onPartitionsAssigned
- Specified by:
onPartitionsAssigned
in interfaceRebalanceListener
-