Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Hazelcast spring client-server recovery mechanism lacking #12128
Sample project available here:
I can't seem to find a good way to deal with hazelcast running in client mode when the server restarts.
In the attached project you will find what I believe to be a correct configuration for jcache usage (and commented code to switch to spring the caching mechanism)
To simulate the problem
With jcache, once the connection to the server node is lost, it does not matter if it's recovered, it will always fail with
With spring cache, it looks like recovery is successful.
It appears that by far the best solution would be to simply let the HazelcastInstance die on connection to server lost and recreate it, however with spring integration this is not so great because the instance was already injected everywhere.
Is there an official way of dealing with this problem, am I missing something or am I simply using it wrong?
Just for playing around, i wrote a small adapter that would clear the cache manager once the connectivity is lost. (to try and just recreate the client rather than hanging on to it)
But this is something for the simple spring cache abstraction, jcache still won't work as it actually casts the HazelcastInstance to the actual implemenation class. It looks like it's tied up to an actual instance which doesn't allow for such flexibility.
JCache 1.1 doesn't make a difference, still gives
The problem seems to be that the client has a proxy onto the ICache, but the ICache doesn't exist on the server side when the server is restarted.
A workaround is for a server side initializer to touch the ICache, creating it. Then the client's proxy is fine when the client reconnects.
When the client reconnects, it should drop/create the ICache proxies to ensure the ICache objects exist on the server side.