FELIX-6863: cache ResourceImpl.hashCode() - #564
Conversation
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(caps, reqs); | ||
| int h = hash; |
There was a problem hiding this comment.
the conditions logic is copied from the String class in Java 9+
|
Two things:
|
|
Hello, thanks for taking the time to check this PR.
Yes, it's measurable, but only in a specific JVM state. All the details are in FELIX-6863. For the red/green comparison, the ticket has a reproducer with before/after numbers in the same scenario:
(https://issues.apache.org/jira/secure/attachment/13084874/feature-uninstall-measurements_300_kars.md) You're right that I first ran into this issue on Karaf 4.4.6, and I was able to reproduce it on 4.4.11. |
paulrutter
left a comment
There was a problem hiding this comment.
Thanks for the change, the caching logic itself looks correct (including the zero-hash handling). Two comments below.
3348035 to
1d5f22b
Compare
|
Thanks, the changes address my comments. Making |
|
In the sources of https://mvnrepository.com/artifact/org.osgi/osgi.core/8.0.0, I still see "An unmodifiable list" in I'll try to propose a bump of this artifact in Karaf. |
|
Agreed, and thanks for checking the osgi.core 8.0.0 sources. The contract is broken in This PR doesn't introduce the violation, but it makes it matter: the cached hash is only invalidated by the Bumping this in Karaf sounds right, since it's the downstream consumer and the place a subclass using the formerly protected fields would break.
|
Fixes FELIX-6863.
org.apache.felix.utils.resourceis embedded in