public class FileSourceFunction<OUT> extends RichParallelSourceFunction<OUT>
SourceFunction.SourceContext<T>| Constructor and Description |
|---|
FileSourceFunction(InputFormat<OUT,?> format,
TypeInformation<OUT> typeInfo) |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Cancels the source.
|
void |
close() |
InputFormat<OUT,InputSplit> |
getFormat()
Returns the
InputFormat. |
void |
open(Configuration parameters) |
void |
run(SourceFunction.SourceContext<OUT> ctx)
Starts the source.
|
getIterationRuntimeContext, getRuntimeContext, setRuntimeContextpublic FileSourceFunction(InputFormat<OUT,?> format, TypeInformation<OUT> typeInfo)
public void open(Configuration parameters) throws Exception
open in interface RichFunctionopen in class AbstractRichFunctionExceptionpublic void close()
throws Exception
close in interface RichFunctionclose in class AbstractRichFunctionExceptionpublic void run(SourceFunction.SourceContext<OUT> ctx) throws Exception
SourceFunctionCollector parameter to emit
elements. Sources that implement
Checkpointed must lock on the
checkpoint lock (using a synchronized block) before updating internal state and/or emitting
elements. Also, the update of state and emission of elements must happen in the same
synchronized block.ctx - The context for interaction with the outside world.Exceptionpublic void cancel()
SourceFunctionSourceFunction.run(org.apache.flink.streaming.api.functions.source.SourceFunction.SourceContext<T>) method. You need to ensure that the source will break out of this loop. This
can be achieved by having a volatile field "isRunning" that is checked in the loop and that
is set to false in this method.public InputFormat<OUT,InputSplit> getFormat()
InputFormat. This is only needed because we need to set the input
split assigner on the StreamGraph.Copyright © 2014–2016 The Apache Software Foundation. All rights reserved.