1 of 1 people found this helpful
Normally the getCache() call won't return until the new node has joined, only in rare occasions it won't find the existing members and start a cluster by itself.
For these rare occasions in Infinispan 5.0 you can register a listener with the @DataRehashed annotation that will be called before and after the key rebalancing. You can check the list of members to see if the node has really joined the existing cluster or you need to wait for another rehash event.
Thanks for the answer, it would be great using v.5.0 but I have to use 4.2.1FINAL. I'm looking for an interceptor for my needs but nothing, anyway I'm interested in sync-replication only.
Even with you can still rely on getCache() returning only after retrieving the state, except in the cases when the node doesn't find the cluster at start and has to merge later.
After a merge however replicated caches don't transfer state, so you can just register a @ViewChanged listener and wait until it's called with a merge view.