-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
Fixed class loader PriorityAwareServiceProvider unable to find all SPI classes. #369
Comments
Would you be able to propose a PR for the mentioned approach? |
@keilw Sure I can create a PR to change the behavior. One question though about the caching. The service provider now uses caching. If it loaded some type once, it will never look for new ones if classes get reloaded dynamically. Is there a reason behind this logic or can it safely be removed. |
@bpasson Maybe for performance reasons, but if you don't see a possible performance penalty, you could try without the caching. |
@keilw Anything special I need to configure when building? Running mvn clean verify on master hangs somewhere in running tests and has numerous failing tests. Using Java 11 and maven 3.8 for building. |
Running mvn clean verify on moneta-core gives failing test cases too, and those don't even fail the build.
Is this the normal behavior atm? Shouldn't a mvn clean verify on a clean checkout just work? |
With Java 11? I suspect it also has something to do with the config issues. |
Yes with Java 11. Could be linked to the config issues, but I only ran the build in moneta-core. I'll give Java 8 a go. |
Java 8 isn't working either, it won't compile the source.
Guess due to the modules in use it needs a minimum of Java 9. |
You can't build with Java 8 anymore, but run it in example or app code. |
Some test failures are related to the config issues. But the following test seems to be invalid imo.
There are two thing odd here:
|
That could have been related to a JUnit upgrade. |
Hope you don't mind me asking too much questions, but why the complicated structure to target 1.8 but still having modules? I always assumed its either modules or not, am I wrong? |
Because it's supposed to be backward-compatible with at least Java 8 for 1.x We may some day change that and set the minimum to e.g. Java 11 with 2.x but for now that makes sense, there are still many Java 8 based systems especially in banking and e-commerce. |
Not a JCP member at the moment. Not sure what is expected. My time is limited currently. Digging into stuff is my nature, I just can't stand it when things don't work and I then need to know why. If the fixes are relatively easy I am always happy to offer PRs. |
Please check out https://jcp.org/en/participation/membership for JCP membership. Most individuals unless hey are self-employed would usually join as Associate Members now. There is no expectation towards the level of contribution, but if you want everyone who contributed more than a line or a few comments may be listed as contributor on the JSR detail page |
Any update on this? |
Not really, since @bpasson is not a JCP member and said, he has limited time, there was nobody looking into it so far. Are you a JCP member @code-uri? |
Those tests are all fixed, mainly due to #357 being fixed, will close this. |
The PriorityAwareServiceProvider, the default service provider for Moneta uses the class loader in which the Money class was loaded for finding additional SPI classes using
ServiceLoader.load(serviceType, Monetary.class.getClassLoader())
. This breaks in environments where SPI classes are not loaded in the same class loader as the libraries. E.g. when using Quarkus in dev-mode. For a reproducer see https://github.com/bpasson/quarkus-class-loading.Why the choice for the more specific
ServiceLoader.load(serviceType, classLoader)
with a class loader parameter overServiceLoader.load(serviceType)
, which uses theThread.currentThread().getContextClassLoader()
?Needs #354
The text was updated successfully, but these errors were encountered: