[英]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. 在我的应用程序中,我在同一台计算机上的两个实例中部署了一个微服务,该微服务使我可以使用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 ).
(供您参考,即时消息使用jgroups进行集群)。 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 ?
infinispan中有一种方法可以通知我infinispan中的节点之间的同步已完成吗?
thank you for your help 谢谢您的帮助
That synchronization is called "state transfer" and you can either have it blocking (ie 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
您可以通过注册DataRehashedEvent的缓存侦听器来接收状态转移完成的事件
You can make the state transfer non-blocking by setting the "await-initial-transfer" attribute to false on the cache state transfer configuration 您可以通过在缓存状态传输配置中将“ await-initial-transfer”属性设置为false来使状态传输成为非阻塞状态
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.