public class ComputationContextImpl extends Object implements ComputationContext
Modifier and Type | Field and Description |
---|---|
protected boolean |
checkpointFlag |
protected LogOffset |
lastOffset |
protected long |
lowWatermark |
protected LogManager |
manager |
protected ComputationMetadataMapping |
metadata |
protected ComputationPolicy |
policy |
protected Map<String,List<Record>> |
streamRecords |
protected boolean |
terminateFlag |
protected Map<String,Long> |
timers |
Constructor and Description |
---|
ComputationContextImpl(ComputationMetadataMapping computationMetadataMapping) |
ComputationContextImpl(LogManager logManager,
ComputationMetadataMapping metadata) |
ComputationContextImpl(LogManager logManager,
ComputationMetadataMapping metadata,
ComputationPolicy policy) |
Modifier and Type | Method and Description |
---|---|
void |
askForCheckpoint()
Ask for checkpoint in order to send records, save input stream offset positions.
|
void |
askForTermination()
Ask to terminate this computation.
|
void |
cancelAskForCheckpoint()
Finally cancel the request to checkpoint the positions.
|
LogOffset |
getLastOffset() |
ComputationPolicy |
getPolicy()
Gets the policy used to run the computation.
|
List<Record> |
getRecords(String streamName) |
long |
getSourceLowWatermark() |
Map<String,Long> |
getTimers() |
void |
produceRecord(String streamName,
Record record) |
LogOffset |
produceRecordImmediate(String streamName,
Record record)
Writes to an output stream immediately.
|
void |
produceRecordImmediate(String streamName,
String key,
byte[] data) |
void |
removeCheckpointFlag() |
void |
removeTimer(String key) |
boolean |
requireCheckpoint() |
boolean |
requireTerminate() |
void |
setLastOffset(LogOffset lastOffset) |
void |
setSourceLowWatermark(long watermark)
Set the low watermark for a source computation.
|
void |
setTimer(String key,
long time)
Register a timer callback for some point in the future
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
produceRecord
protected final ComputationMetadataMapping metadata
protected final Map<String,List<Record>> streamRecords
protected final LogManager manager
protected final ComputationPolicy policy
protected boolean checkpointFlag
protected long lowWatermark
protected boolean terminateFlag
protected LogOffset lastOffset
public ComputationContextImpl(LogManager logManager, ComputationMetadataMapping metadata, ComputationPolicy policy)
public ComputationContextImpl(LogManager logManager, ComputationMetadataMapping metadata)
public ComputationContextImpl(ComputationMetadataMapping computationMetadataMapping)
public List<Record> getRecords(String streamName)
public void setTimer(String key, long time)
ComputationContext
setTimer
in interface ComputationContext
key
- Name of the timer callback.time
- The (ms since epoch) at which the callback should be firedpublic void removeTimer(String key)
public void produceRecord(String streamName, Record record)
produceRecord
in interface ComputationContext
public LogOffset produceRecordImmediate(String streamName, Record record)
produceRecord(String, Record)
when possible.public void produceRecordImmediate(String streamName, String key, byte[] data)
public LogOffset getLastOffset()
getLastOffset
in interface ComputationContext
public ComputationPolicy getPolicy()
ComputationContext
getPolicy
in interface ComputationContext
public void setLastOffset(LogOffset lastOffset)
public long getSourceLowWatermark()
public void setSourceLowWatermark(long watermark)
ComputationContext
setSourceLowWatermark
in interface ComputationContext
public boolean requireCheckpoint()
public void removeCheckpointFlag()
public void askForCheckpoint()
ComputationContext
askForCheckpoint
in interface ComputationContext
public void cancelAskForCheckpoint()
ComputationContext
cancelAskForCheckpoint
in interface ComputationContext
public void askForTermination()
ComputationContext
askForTermination
in interface ComputationContext
public boolean requireTerminate()
Copyright © 2019 Nuxeo. All rights reserved.