OUT
- The output type of the operator@PublicEvolving public interface StreamOperator<OUT> extends Serializable
OneInputStreamOperator
or
TwoInputStreamOperator
to create operators
that process elements.
The class AbstractStreamOperator
offers default implementation for the lifecycle and properties methods.
Methods of StreamOperator
are guaranteed not to be called concurrently. Also, if using
the timer service, timer callbacks are also guaranteed not to be called concurrently with
methods on StreamOperator
.
Modifier and Type | Method and Description |
---|---|
void |
close()
This method is called after all records have been added to the operators via the methods
OneInputStreamOperator.processElement(StreamRecord) , or
TwoInputStreamOperator.processElement1(StreamRecord) and
TwoInputStreamOperator.processElement2(StreamRecord) . |
void |
dispose()
This method is called at the very end of the operator's life, both in the case of a successful
completion of the operation, and in the case of a failure and canceling.
|
ChainingStrategy |
getChainingStrategy() |
boolean |
isInputCopyingDisabled()
An operator can return true here to disable copying of its input elements.
|
void |
notifyOfCompletedCheckpoint(long checkpointId)
Called when the checkpoint with the given ID is completed and acknowledged on the JobManager.
|
void |
open()
This method is called immediately before any elements are processed, it should contain the
operator's initialization logic.
|
void |
restoreState(StreamTaskState state,
long recoveryTimestamp)
Restores the operator state, if this operator's execution is recovering from a checkpoint.
|
void |
setChainingStrategy(ChainingStrategy strategy) |
void |
setKeyContextElement1(StreamRecord<?> record) |
void |
setKeyContextElement2(StreamRecord<?> record) |
void |
setup(StreamTask<?,?> containingTask,
StreamConfig config,
Output<StreamRecord<OUT>> output)
Initializes the operator.
|
StreamTaskState |
snapshotOperatorState(long checkpointId,
long timestamp)
Called to draw a state snapshot from the operator.
|
void setup(StreamTask<?,?> containingTask, StreamConfig config, Output<StreamRecord<OUT>> output)
void open() throws Exception
Exception
- An exception in this method causes the operator to fail.void close() throws Exception
OneInputStreamOperator.processElement(StreamRecord)
, or
TwoInputStreamOperator.processElement1(StreamRecord)
and
TwoInputStreamOperator.processElement2(StreamRecord)
.
The method is expected to flush all remaining buffered data. Exceptions during this flushing of buffered should be propagated, in order to cause the operation to be recognized asa failed, because the last data items are not processed properly.
Exception
- An exception in this method causes the operator to fail.void dispose()
StreamTaskState snapshotOperatorState(long checkpointId, long timestamp) throws Exception
checkpointId
- The ID of the checkpoint.timestamp
- The timestamp of the checkpoint.Exception
- Forwards exceptions that occur while drawing snapshots from the operator
and the key/value state.void restoreState(StreamTaskState state, long recoveryTimestamp) throws Exception
This method is called after setup(StreamTask, StreamConfig, Output)
and before open()
.
state
- The state of operator that was snapshotted as part of checkpoint
from which the execution is restored.recoveryTimestamp
- Global recovery timestampException
- Exceptions during state restore should be forwarded, so that the system can
properly react to failed state restore and fail the execution attempt.void notifyOfCompletedCheckpoint(long checkpointId) throws Exception
checkpointId
- The ID of the checkpoint that has been completed.Exception
- Exceptions during checkpoint acknowledgement may be forwarded and will cause
the program to fail and enter recovery.void setKeyContextElement1(StreamRecord<?> record) throws Exception
Exception
void setKeyContextElement2(StreamRecord<?> record) throws Exception
Exception
boolean isInputCopyingDisabled()
ExecutionConfig
ChainingStrategy getChainingStrategy()
void setChainingStrategy(ChainingStrategy strategy)
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.