New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FLINK-16135][core] Unify the TemporaryClassLoaderContext and AutoContextClassLoader #11120
Conversation
Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community Automated ChecksLast check on commit ea8fa29 (Tue Feb 18 09:43:53 UTC 2020) Warnings:
Mention the bot in a comment to re-run the automated checks. Review Progress
Please see the Pull Request Review Guide for a full explanation of the review process. The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commandsThe @flinkbot bot supports the following commands:
|
…textClassLoader These two classes did teh same thing, this commit unifies the use to a consolidated instance.
ea8fa29
to
d809478
Compare
@@ -43,7 +45,8 @@ | |||
* } | |||
* </pre> | |||
*/ | |||
public final class AutoContextClassLoader implements AutoCloseable { | |||
@Public |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why @Public
? Do we actually expect users to use this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure. I thought it was a simple enough utility such that it would not hurt to expose it, but we can also conservatively start with @Internal
.
Will change the |
What is the purpose of the change
These two classes do basically same thing, this PR unifies the use to a consolidated implementation.
The consolidated implementation
org.apache.flink.util
(not in the plugins sub-package) because it is intended as a general utilTemporaryClassLoaderContext
(better name)TemporaryClassLoaderContext.of(classLoader)
pattern from theAutoContextClassLoader
. This pattern is more in line with the "don't do work in the constructor" coding guide. This also makes it more future-proof, in case we need to do extended handling in the future for specific classloaders (child-first, plugins) or more elaborate handling of thread local variables, etc.