Hazelcast:在客户端模式下,每个群集仅执行一次EntryEvictedListener [英] Hazelcast: Execute EntryEvictedListener only once per cluster in client mode

查看:114
本文介绍了Hazelcast:在客户端模式下,每个群集仅执行一次EntryEvictedListener的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用多个节点上的Java客户端连接到Hazelcast集群.

We are connecting to Hazelcast cluster using Java clients from multiple nodes.

HazelcastClient.newHazelcastClient(cfg)

我们需要每个集群只执行一次EntryEvictedListener. 默认情况下,它在所有连接的客户端上执行.

We need our EntryEvictedListener to be executed only once per cluster. By default it is executed on all connected clients.

找到了如何通过嵌入Hazelcast实现这一目标的方法( Hazelcast中基于时间的逐出 ),但看起来像

Found how to reach this goal with Hazelcast embedded (Time Based Eviction in Hazelcast), but looks like

map.addLocalEntryListener(...) 

客户端不允许

.

is not allowed for client.

那么有什么方法可以使用客户端在每个群集中仅执行一次逐出侦听器吗?

So is there any way to execute eviction listener only once per cluster using client?

推荐答案

不幸的是没有.您的监听器需要在群集节点上运行,因为local直接连接到基础分区方案.您想在逐出事件上做什么,也许您可​​以通过其他方式实现它.

Unfortunately not. You're listener would need to run on a cluster node, since the local is directly connected to the underlying partitioning scheme. What do you want to do on the evict event, maybe you can achieve it differently.

这篇关于Hazelcast:在客户端模式下,每个群集仅执行一次EntryEvictedListener的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆