user3822342
user3822342

Reputation: 377

infinispan - Synchronization between nodes -state-transfer -notification

in my application , i have a micro service deployed in two instances in the same machine , the micro service allow me to insert some data in the cache using infnispan. first i started just one instance and i put samed data in the cache , but when i started the second one , i noticed that there is a synchronisation between them... its normal because the second on is join the cluster. (for your information , im using jgroups for clustering ). so when i call a service to retrive same data for the second instance , it did'nt answer because its in phase of synchronization , he dosent have the data. but when it finishes he return me a response;

so my question is how can i know that the synchronization between these two instances are terminated ? there is a way in infinispan to notify me that the synchronisation between nodes in infinispan is finished ?

thank you for your help

Upvotes: 0

Views: 304

Answers (1)

Tristan Tarrant
Tristan Tarrant

Reputation: 1504

That synchronization is called "state transfer" and you can either have it blocking (i.e. nodes wait for the initial transfer before becoming responsive) or non-blocking (which means they immediately respond to requests, retrieving entries remotely if they haven't been transferred yet). You can receive an event for the state transfer completion by registering a cache listener for the DataRehashedEvent

You can make the state transfer non-blocking by setting the "await-initial-transfer" attribute to false on the cache state transfer configuration

Upvotes: 1

Related Questions