我正在尝试使用 Spring 将 Hazelcast 地图配置为使用入口侦听器。但是,我发现它不起作用(事件没有到达侦听器)。我的入口监听器:public class MyMapListener extends EntryAdapter<String, String> implements MapListener{ @Override public void onEntryEvent(EntryEvent<String, String> event) { EntryEventType type = event.getEventType(); System.out.println("Event type: " + type); }}我的 Spring 应用程序上下文:<hz:hazelcast id="instance"> <hz:config> <hz:group name="dev" password="password"/> <hz:properties> <hz:property name="hazelcast.merge.first.run.delay.seconds">5</hz:property> <hz:property name="hazelcast.merge.next.run.delay.seconds">5</hz:property> </hz:properties> <hz:network port="5705" port-auto-increment="true"> <hz:join> <hz:multicast enabled="true"/> </hz:join> </hz:network> <hz:map name="myMap" > <hz:entry-listeners> <hz:entry-listener class-name="rw.gov.dgie.bms.hazelcast.listener.map.MyMapListener" include-value="true"/> <hz:entry-listener implementation="myMapListener" local="true"/> </hz:entry-listeners> </hz:map> </hz:config></hz:hazelcast><hz:client id="client"> <hz:group name="dev" password="password"/> <hz:network> <hz:member>127.0.0.1:5705</hz:member> </hz:network></hz:client><bean class="rw.gov.dgie.bms.hazelcast.listener.map.MyMapListener" name="myMapListener"/><hz:map id="myMap" instance-ref="instance" name="MyMap" lazy-init="false"/>当我将侦听器添加到从 Java 代码注入的映射时,它工作正常:@Autowiredprivate IMap myMap;myMap.addEntryListener((MapListener)new MyMapListener(), true);我做错了什么?
添加回答
举报
0/150
提交
取消