[
https://issues.apache.org/jira/browse/FLINK-20657?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17252893#comment-17252893
]
Kezhu Wang commented on FLINK-20657:
------------------------------------
[~jark] [~roman_khachatryan] Seems that we have basic convergence on
{{SimpleJdbcConnectionProvider.closeConnection}} to close {{transient}} field
{{connection}}. If pure factory-like class is required in future, we could do
it at that phase. Fortunately, {{JdbcConnectionProvider}} is {{Internal}}.
[~roman_khachatryan] How about dropping {{synchronized}} and annotating
{{SimpleJdbcConnectionProvider}} with {{NotThreadSafe}} to clear its current
usage ? Otherwise {{SimpleJdbcConnectionProvider.closeConnection}} have to
{{synchronized(this)}} also to match {{getConnection}}. I think with close
operation in mind, it is hard to make both {{SimpleJdbcConnectionProvider}} and
{{Connection}} thread safe. How one could know whether a connection is safe to
use while concurrent {{SimpleJdbcConnectionProvider.closeConnection}} is
possible ?
> Migrate jdbc connection code of JdbcInputFormat, JdbcLookupFunction,
> JdbcRowDataLookupFunction to SimpleJdbcConnectionProvider
> ------------------------------------------------------------------------------------------------------------------------------
>
> Key: FLINK-20657
> URL: https://issues.apache.org/jira/browse/FLINK-20657
> Project: Flink
> Issue Type: Improvement
> Components: Connectors / JDBC, Table SQL / Ecosystem
> Affects Versions: 1.13.0
> Reporter: Kezhu Wang
> Assignee: Kezhu Wang
> Priority: Major
>
> Currently, there are multiple places to establish jdbc connection, several of
> them were written before introducing of {{JdbcConnectionProvider}} in
> FLINK-15782. We need to migrate these classes for reasons:
> * Code reusability.
> * Circumvent pitfalls of {{DriverManager}} such as FLINK-19435 and possible
> [others|https://ci.apache.org/projects/tomcat/tomcat85/docs/jndi-datasource-examples-howto.html#DriverManager,_the_service_provider_mechanism_and_memory_leaks]
> in one place.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)