public class ComputationRunner extends Object implements Runnable, RebalanceListener
Modifier and Type | Field and Description |
---|---|
protected CountDownLatch |
assignmentLatch |
protected Computation |
computation |
protected ComputationContextImpl |
context |
protected long |
counter |
protected boolean |
drain |
protected static long |
INACTIVITY_BREAK_MS |
protected long |
inCheckpointRecords |
protected Codec<Record> |
inputCodec |
protected long |
inRecords |
protected long |
lastReadTime |
protected long |
lastTimerExecution |
protected LogManager |
logManager |
protected WatermarkMonotonicInterval |
lowWatermark |
protected ComputationMetadataMapping |
metadata |
protected Codec<Record> |
outputCodec |
protected long |
outRecords |
protected ComputationPolicy |
policy |
static Duration |
READ_TIMEOUT |
protected static long |
STARVING_TIMEOUT_MS |
protected boolean |
stop |
protected Supplier<Computation> |
supplier |
protected LogTailer<Record> |
tailer |
protected String |
threadName |
Constructor and Description |
---|
ComputationRunner(Supplier<Computation> supplier,
ComputationMetadataMapping metadata,
List<LogPartition> defaultAssignment,
LogManager logManager,
Codec<Record> inputCodec,
Codec<Record> outputCodec,
ComputationPolicy policy) |
Modifier and Type | Method and Description |
---|---|
protected void |
checkpoint() |
protected void |
checkpointIfNecessary() |
protected void |
checkRecordFlags(Record record) |
protected void |
checkSourceLowWatermark() |
protected void |
closeTailer() |
protected boolean |
continueLoop() |
void |
drain() |
Watermark |
getLowWatermark() |
protected Duration |
getTimeoutDuration() |
void |
onPartitionsAssigned(Collection<LogPartition> partitions) |
void |
onPartitionsRevoked(Collection<LogPartition> partitions) |
protected void |
processFallback(ComputationContextImpl context) |
protected void |
processLoop() |
protected boolean |
processRecord() |
protected void |
processRecordWithRetry(String from,
Record record) |
protected boolean |
processTimer() |
protected void |
processTimerWithRetry(String key,
Long value) |
void |
run() |
protected void |
saveOffsets() |
protected void |
saveState() |
protected void |
saveTimers() |
protected void |
sendRecords() |
protected void |
setThreadName(String message) |
void |
stop() |
boolean |
waitForAssignments(Duration timeout) |
public static final Duration READ_TIMEOUT
protected static final long STARVING_TIMEOUT_MS
protected static final long INACTIVITY_BREAK_MS
protected final LogManager logManager
protected final ComputationMetadataMapping metadata
protected final Supplier<Computation> supplier
protected final CountDownLatch assignmentLatch
protected final WatermarkMonotonicInterval lowWatermark
protected final Codec<Record> inputCodec
protected final Codec<Record> outputCodec
protected final ComputationPolicy policy
protected ComputationContextImpl context
protected volatile boolean stop
protected volatile boolean drain
protected Computation computation
protected long counter
protected long inRecords
protected long inCheckpointRecords
protected long outRecords
protected long lastReadTime
protected long lastTimerExecution
protected String threadName
public ComputationRunner(Supplier<Computation> supplier, ComputationMetadataMapping metadata, List<LogPartition> defaultAssignment, LogManager logManager, Codec<Record> inputCodec, Codec<Record> outputCodec, ComputationPolicy policy)
public void stop()
public void drain()
public boolean waitForAssignments(Duration timeout) throws InterruptedException
InterruptedException
protected void closeTailer()
protected void processLoop() throws InterruptedException
InterruptedException
protected boolean continueLoop()
protected boolean processTimer()
protected void processTimerWithRetry(String key, Long value)
protected boolean processRecord() throws InterruptedException
InterruptedException
protected void processRecordWithRetry(String from, Record record)
protected void processFallback(ComputationContextImpl context)
protected Duration getTimeoutDuration()
protected void checkSourceLowWatermark()
protected void checkRecordFlags(Record record)
protected void checkpointIfNecessary()
protected void checkpoint()
protected void saveTimers()
protected void saveState()
protected void saveOffsets()
protected void sendRecords()
public Watermark getLowWatermark()
protected void setThreadName(String message)
public void onPartitionsRevoked(Collection<LogPartition> partitions)
onPartitionsRevoked
in interface RebalanceListener
public void onPartitionsAssigned(Collection<LogPartition> partitions)
onPartitionsAssigned
in interface RebalanceListener
Copyright © 2019 Nuxeo. All rights reserved.