[
https://issues.apache.org/jira/browse/FLINK-3777?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15253807#comment-15253807
]
ASF GitHub Bot commented on FLINK-3777:
---------------------------------------
Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/1903#discussion_r60728363
--- Diff:
flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/InputFormatVertex.java
---
@@ -64,13 +65,19 @@ public void initializeOnMaster(ClassLoader loader)
throws Exception {
}
// instantiate, if necessary
- InputFormat<?, ?> inputFormat;
+ InputFormat<?, ?> inputFormat = null;
try {
inputFormat =
wrapper.getUserCodeObject(InputFormat.class, loader);
}
catch (Throwable t) {
throw new Exception("Instantiating the InputFormat (" +
formatDescription + ") failed: " + t.getMessage(), t);
}
+ finally{
+ // close the instantiated resources before returning
+ if(inputFormat != null && inputFormat instanceof
RichInputFormat) {
--- End diff --
`inputFormat.configure()` has not been called yet. Why are you closing it?
> Add open and close methods to manage IF lifecycle
> -------------------------------------------------
>
> Key: FLINK-3777
> URL: https://issues.apache.org/jira/browse/FLINK-3777
> Project: Flink
> Issue Type: Improvement
> Components: Core
> Affects Versions: 1.0.1
> Reporter: Flavio Pompermaier
> Assignee: Flavio Pompermaier
> Labels: inputformat, lifecycle
>
> At the moment the opening and closing of an inputFormat are not managed,
> although open() could be (improperly IMHO) simulated by configure().
> This limits the possibility to reuse expensive resources (like database
> connections) and manage their release.
> Probably the best option would be to add 2 methods (i.e. openInputformat()
> and closeInputFormat() ) to RichInputFormat*
> * NOTE: the best option from a "semantic" point of view would be to rename
> the current open() and close() to openSplit() and closeSplit() respectively
> while using open() and close() methods for the IF lifecycle management, but
> this would cause a backward compatibility issue...
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)