-
Notifications
You must be signed in to change notification settings - Fork 55
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
Recover from incorrect JDK #441
Recover from incorrect JDK #441
Conversation
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.
Thanks, Marek!
The issue seems a bit trickier than it appears, because there are two symlink redirections in our configuration, but it doesn't make much sense for the plugin to detect the chain of symlinks IMO, e.g.
1.
# ls -l /Library/Java/JavaVirtualMachines/TwitterJDK
lrwxr-xr-x 1 root wheel 40 Nov 23 13:28 /Library/Java/JavaVirtualMachines/TwitterJDK -> /opt/twitter_mde/package/TwitterJDK/current
# ls -l /opt/twitter_mde/package/TwitterJDK/current
lrwxr-xr-x 1 root managed_dev_env 3 Nov 23 13:14 /opt/twitter_mde/package/TwitterJDK/current -> xyz
So, I was thinking instead of detecting and changing the SDK automatically, how about we make it an action called Refresh Pants Project SDK
under the Pants
menu, leaving it to user to decide when to trigger the refresh the SDK configuration?
The status quo was
- User has to remove the existing SDK
- Reimport the project which then recreates the SDK
With the improvement, user only needs to trigger the Refresh Pants Project SDK
while the project is open.
That sounds way simpler, so than relying on some automagic, so I agree it might be preferable. |
Looks like this the refresh action is running on the UI thread, causing:
|
Would it possible that this does not run on the EDT thread?
|
I have missed one spot where a heavy action was running on the UI thread, now it should be good.
Is your intention here to change the invalidate action to run on non-UI thread? Were there any freezes or errors with the invalidate action? |
invalidate action itself is super quick, so your change should suffice. I will double check when back online. |
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.
Thanks, Marek! would you mind resolve the merge conflict? Then I will merge it in.
Previously, the refresh was happening on the EDT thread which caused errors and freezes because of a process being started inside the "createPantsJdk" call. As a result of running in the background, changing the project JDK (if it wasn't a pants' one) must be scheduled to run in a dispatcher thread.
Getting the default JDK might take a long time if there is no pants JDK present and export cache is empty as we have to run an external process.
This adds a "Refresh Pants Project SDK" action to Pants drop-down menu.
When activated, this action will refresh the sdk of the current project.
If the SDK is not set or is not a pants-generated one, a pants SDK will be generated if needed and set as a project's SDK. If it already is a pants-generated SDK, it will be regenerated.