[SHIRO-816] Hazelcast support does not support HZ v4#308
[SHIRO-816] Hazelcast support does not support HZ v4#308cstamas wants to merge 1 commit intoapache:mainfrom
Conversation
The reason is that getMap method return value changed, and JVM does not find the method (if compiled with HZ3 and runtime uses HZ4 - same would happen other way around). Fix has two parts: determines IMap class (v3 or v4), and them use MethodHandle to invoke it.
|
What is the benefit over an explicit hz4 implementation? This implementation might slow down hz3 a bit. But furthermore, if we replaced this with hz4 at some point in the future, hz3 would intransparently stop working (at least for Shiro 1.8). Thus, might adding a new module be an option? Otherwise I'd say yes here, too. |
|
@bmarwell as I see (in POM), the intent was to seamlessly work with both, HZ 3.x and HZ 4.x (at least that's what import range suggests). But alas, this never worked with both, as AFAIK the |
|
Shouldn't the import for OSGI be modified as well? |
Ah, missed that part. Good thing it is now documented here. 😊
Sure, the reflection will only occur once. Nothing to correct here. Thanks for confirming. LGTM then! 👍🏻 |
@jherkel hm, now I realize I am wrong, it is currently So maybe my whole premise ("intent was to work with HZ 3 AND HZ4") is completely wrong? As it may also mean that SHIRO-816 is a "non issue" actually (should be closed as such: "Shiro 1.x Hazelcast support supports HZ3 only"), given the module was never intended to work with HZ4 in the first place? As then, IMO proper solution is to
|
|
I think someone came up on slack that this could easily be made compatible with both 3 and 4. That's why I asked for a new hz4 module before that came up. And yes, as we are having a maintenance release here, I'd suggest: WDYT? |
IMO (here am talking about current main branch, not this PR changes):
Again, IMO here is nothing to be done, but:
Personally, I'd not complicate things, by adding burden of "magic" to make something work that was never specd/promised to work. HZ4 did intentional Java package changes, similar to javax.servlet vs jakarta.servlet... so next will be to support those transparently as well? |
|
Could also tweak the OSGI config and run another set of UT's to run with hz4? Another option would be to create a new module |
That was my initial idea. Sorry for my brevity, this is what I meant all along.
-1. Both Shiro major versions should use
Agreed on this one. |
|
FWIW, I just dropped shiro-hazelcast as dependency from my project: if you consider it, that one class dependency is really an overkill, is not worth it. Hence, am building my CacheManager (is in my sources), so the project does not suffer from this issue. Really, dependency carrying one single class is an overkill IMHO. |
|
@cstamas is right. A one-class dependency is probably an overkill for most users. I will suggest to drop it completely, so this becomes a |
|
Will rebase for 1.x though |
|
@dependabot recreate |
|
Superseded by #1002 |
The reason is that getMap method return value changed, and
JVM does not find the method (if compiled with HZ3 and runtime
uses HZ4 - same would happen other way around).
Fix has two parts: determines IMap class (v3 or v4),
and them use MethodHandle to invoke it.