-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Added classloader safe configuration of event listener #11951
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
two comments:
|
Just double checked. I am not able to get the same behavior when setting the TCCL in my own factory's implementation of the create() method. It throws the same errors. This PR was suggested by Dain in this Presto user group thread: I agree that this likely needs to be changed in many places, but I am in no position to make those changes myself. I am much more familiar with this part of the code due to my current project. Let me know your thoughts. |
@findepi this is the equivilant of the code we have in |
@dain i agree with the change in general (see #11951 (comment) "i think we generally should isolate plugins by default ...") i remain curious why this works when TCCL is installed before calling the connector and does not work when TCCL is installed as the first thing in the connector code. |
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.
The commit message needs improvement. What about:
Set ClassLoader when calling EventListenerFactory
Before the change, certain libraries cannot be used in an event
listener implementation.
@findepi I suspect it should work in either case. I'm trying to imagine if there could be static initialization which loads classes and would only hit one case, but that seems doubtful as the event factory instance already exists at this point. |
@electrum i thought the same @gray-eb please update the commit message (#11951 (review)) and ping me back. |
Before the change, certain libraries cannot be used in an event listener implementation.
@findepi I've updated the commit message. If you still need steps to reproduce the issue let me know, but I was not able to reproduce the fix within the plugin's EventListenerFactory code. As some loose steps to reproduce:
You should get a LinkageError related to javax.ws.rs-api-2.x classes until you implement the change in this commit. |
I had an Event Listener plugin that needed to utilize Jersey REST client libraries, but it constantly clashed with the server's libraries. Even after adding a wrapper within the plugin, the issue persisted. It led me to this solution.
This change is analogous to the current state of ConnectorManager.java
Creating a ClassLoaderSafeEventListener similar to the ClassLoaderSafeConnectorMetadata allows me to use the libraries without any conflicts.