Stephan Ewen created FLINK-17699:
------------------------------------
Summary: Reduce scope for SourceOperator arguments and initialize more eagerly
Key: FLINK-17699
URL:
https://issues.apache.org/jira/browse/FLINK-17699 Project: Flink
Issue Type: Sub-task
Components: API / DataStream
Reporter: Stephan Ewen
Assignee: Stephan Ewen
Fix For: 1.11.0
Currently, the {{SourceOperator}} only gets a {{Source}} in the constructor.
All actual components that the {{SourceOperator}} relies on when working are lazily initialized, in {{open()}} or via setters.
Relying on something as broad as {{Source}} also means that a lot of redundant context has to be provided to the {{SourceOperator}} during initialization. The {{Source}} is, for example, also responsible for the {{SourceEnumerator}}, which is independent of the {{SourceOperator}}. However, it needs to be considered during testing, now, because the tests need to mock a full {{Source}} in order to instantiate a {{SourceOperator}}.
The solution is to directly pass the collaborators of the {{SourceOperator}} directly eagerly into the constructor. It is not fully possible with the {{SourceReader}}, but for that we can at least reduce the scope by passing a targeted factory function.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)