gpt4 book ai didi

java - 无法在 Hazelcast 中创建 map 条目

转载 作者:行者123 更新时间:2023-11-30 04:30:38 25 4
gpt4 key购买 nike

我在 Eclipse 中使用 Hazelcast v2.5 和 Maven 插件。我尝试在 Eclipse 中运行一个示例程序,该程序在 ABCD 命名空间中创建 3 个映射条目。当我在 Eclipse 中运行代码时,它显示此警告消息

Feb 07, 2013 12:08:23 PM com.hazelcast.impl.ConcurrentMapManager
WARNING: [192.168.1.36]:5702 [dev] Caller -> RedoLog{name=c:ABCD, redoType=REDO_TARGET_UNKNOWN, operation=CONCURRENT_MAP_MERGE, target=null / connected=false, redoCount=53, migrating=null
partition=Partition [227]{
}
}

这将继续迭代,直到超过重做阈值。

Feb 07, 2013 12:08:42 PM com.hazelcast.impl.LifecycleServiceImpl
WARNING: [192.168.1.36]:5702 [dev] [CONCURRENT_MAP_MERGE] Redo threshold[90] exceeded! Last redo cause: REDO_TARGET_UNKNOWN, Name: c:ABCD
com.hazelcast.core.OperationTimeoutException: [CONCURRENT_MAP_MERGE] Redo threshold[90] exceeded! Last redo cause: REDO_TARGET_UNKNOWN, Name: c:ABCD
at com.hazelcast.impl.BaseManager$ResponseQueueCall.getRedoAwareResult(BaseManager.java:640)
at com.hazelcast.impl.BaseManager$ResponseQueueCall.getResult(BaseManager.java:627)
at com.hazelcast.impl.BaseManager$RequestBasedCall.getResultAsBoolean(BaseManager.java:437)
at com.hazelcast.impl.BaseManager$ResponseQueueCall.getResultAsBoolean(BaseManager.java:544)
at com.hazelcast.impl.ConcurrentMapManager$MPut.mergeOne(ConcurrentMapManager.java:1758)
at com.hazelcast.impl.ConcurrentMapManager$MPut.merge(ConcurrentMapManager.java:1747)
at com.hazelcast.impl.LifecycleServiceImpl$1.run(LifecycleServiceImpl.java:143)
at com.hazelcast.impl.executor.ParallelExecutorService$ParallelExecutorImpl$ExecutionSegment.run(ParallelExecutorService.java:212)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at com.hazelcast.impl.ExecutorThreadFactory$1.run(ExecutorThreadFactory.java:38)

为什么会出现这种情况?

请帮忙!

最佳答案

您可以执行以下操作来开始使用准系统 Java 类(我建议您阅读更详细的教程,因为它可能更有用 - 我还没有详细介绍如何访问 Hazelcast 服务):

  1. 在 hazelcast.xml 文件中指定 map ,如下所示:

       <map name="testMap">     
    <backup-count>1</backup-count>
    <eviction-policy>NONE</eviction-policy>
    <max-size policy="cluster_wide_map_size">0</max-size>
    <eviction-percentage>25</eviction-percentage>
    <merge-policy>hz.ADD_NEW_ENTRY</merge-policy>
    <map-store enabled="true">
    <class-name>models.test.StoreLoadTestMap</class-name>
    <write-delay-seconds>5</write-delay-seconds>
    </map-store>
    <entry-listeners>
    <entry-listener include value="true"local="false">models.test.ListenerTestMap</entry-listener>
    </entry-listeners>
    </map>

完成后,您只需从 Java 应用程序中调用以下命令即可:

IMap<String, testObject> testMap = Hazelcast.getMap("testMap");

现在,您应该能够根据需要向 map 输入值或从 map 获取值。您可以根据您的用例使用 tcp 或多播进行复制(如果可能,请使用 tcp),并从第二个映射中检索信息以确认数据复制。另请了解数据如何在 map 之间复制。

希望对你有帮助

关于java - 无法在 Hazelcast 中创建 map 条目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14745513/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com