Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

StephanEwen
Copy link
Contributor

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

  • Resides in org.apache.flink.util (not in the plugins sub-package) because it is intended as a general util
  • Is called TemporaryClassLoaderContext (better name)
  • Uses TemporaryClassLoaderContext.of(classLoader) pattern from the AutoContextClassLoader. 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.

@flinkbot
Copy link
Collaborator

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit ea8fa29 (Tue Feb 18 09:43:53 UTC 2020)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

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 commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

…textClassLoader

These two classes did teh same thing, this commit unifies the use to a consolidated instance.
@flinkbot
Copy link
Collaborator

flinkbot commented Feb 18, 2020

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run travis re-run the last Travis build
  • @flinkbot run azure re-run the last Azure build

@@ -43,7 +45,8 @@
* }
* </pre>
*/
public final class AutoContextClassLoader implements AutoCloseable {
@Public
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@StephanEwen
Copy link
Contributor Author

Will change the @Public to @Internal for now and merge this, unless there are further objections.

@StephanEwen StephanEwen deleted the cl_unify branch February 19, 2020 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants