-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[BEAM-2530] Make classloader handling more compatible with JDK 9 #4497
Closed
+7
−0
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
this logic https://github.com/apache/geronimo-xbean/blob/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ClassLoaders.java#L38 can be beneficial. High level idea is to use getResources() to determine what is in the classloader.
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.
Do you find in practice that all Java jars have a
META-INF
folder?Also, it doesn't seem that
getResources
guarantees to return the same order of jars as specified on the classpath.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.
That isn't guaranteed to work for all jars -
jar M
will create an archive that doesn't contain aMETA-INF
folder.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.
This is why it is not the only strategy but likely the most portable i saw accross years. In particular in the context of this method. Do you expect all jars to be in the cp string? Not using manifest to load jars ;)
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.
Neither approach is going to work in all cases, but I've had more success with this one.
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.
Did you test this class? getResources("") - not only metainf -
works on most jvm and supports all cases compared to classpath scanning which doesnt support a lot of bootstraps except plain mains :(.
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.
I have tested this logic, but I haven't been able to test this specific usage of it. I ran into a similar problem I'm fixing in GoogleCloudPlatform/DataflowJavaSDK#621 and thought it was worth fixing here too.
If you'd like to defer until we're sure it's a problem, or implement the
getResources
approach instead, that's fine with me :)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.
I think this approach seems to solve a legitimate issue and other approaches can be implemented and added.
If you have a good idea on how to test this effectively since its easy to break this kind of functionality without knowing it.
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.
to share the idea here what i had in mind high level #4514