public class LatencyTrackerComputation extends AbstractComputation
Modifier and Type | Field and Description |
---|---|
protected Codec<Record> |
codec |
protected int |
count |
protected int |
intervalMs |
protected List<LogPartitionGroup> |
logGroups |
protected List<String> |
logNames |
protected LogManager |
manager |
protected static String |
OUTPUT_STREAM |
protected int |
remaining |
protected boolean |
verbose |
metadata
Constructor and Description |
---|
LatencyTrackerComputation(LogManager manager,
List<String> logNames,
String computationName,
int intervalSecond,
int count,
boolean verbose,
Codec<Record> codec) |
Modifier and Type | Method and Description |
---|---|
protected void |
debug(String msg) |
static LogPartitionGroup |
decodeKey(String key) |
void |
destroy()
Called when the framework is ready to shutdown the computation.
|
static String |
encodeKey(LogPartitionGroup logGroup,
int partition) |
protected byte[] |
encodeLatency(Latency latency) |
protected void |
error(String msg) |
protected List<Latency> |
getLatenciesForPartition(LogPartitionGroup logGroup,
Codec<Record> codec) |
protected void |
info(String msg) |
void |
init(ComputationContext context)
Called when the framework has registered the computation successfully.
|
void |
processRecord(ComputationContext context,
String inputStreamName,
Record record)
Process an incoming record on one of the computation's input streams.
|
void |
processTimer(ComputationContext context,
String key,
long timestamp)
Process a timer callback previously set via
ComputationContext.setTimer(String, long) . |
metadata
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
signalStop
protected static final String OUTPUT_STREAM
protected final LogManager manager
protected final int intervalMs
protected final int count
protected final boolean verbose
protected int remaining
protected List<LogPartitionGroup> logGroups
public LatencyTrackerComputation(LogManager manager, List<String> logNames, String computationName, int intervalSecond, int count, boolean verbose, Codec<Record> codec)
public void init(ComputationContext context)
Computation
init
in interface Computation
init
in class AbstractComputation
context
- The computation context object provided by the system.public void processTimer(ComputationContext context, String key, long timestamp)
Computation
ComputationContext.setTimer(String, long)
.processTimer
in interface Computation
processTimer
in class AbstractComputation
context
- The computation context object provided by the system.key
- The name of the timer.timestamp
- The timestamp (in ms) for which the callback was scheduled.protected byte[] encodeLatency(Latency latency)
protected List<Latency> getLatenciesForPartition(LogPartitionGroup logGroup, Codec<Record> codec)
public static String encodeKey(LogPartitionGroup logGroup, int partition)
public static LogPartitionGroup decodeKey(String key)
public void destroy()
Computation
public void processRecord(ComputationContext context, String inputStreamName, Record record)
Computation
context
- The computation context object provided by the system.inputStreamName
- Name of the input stream that provides the record.record
- The record.Copyright © 2018 Nuxeo. All rights reserved.