当前位置: 动力学知识库 > 问答 > 编程问答 >

java - Unable to Create map entries in Hazelcast

问题描述:

I am using Hazelcast v2.5 and Maven plugin in Eclipse . I tried running an example program in Eclipse which creates 3 map entries in the ABCD namespace . When I run my code in Eclipse it shows this WARNING message

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]{

}

}

This keeps on Iterating till the redo threshold exceeds.

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)

Why does this occur ?

Please Help.!

网友答案:

You can do the following just to get started with a barebones Java class (I suggest you go through a more detailed tutorial as it might be more useful - I have not gone over accessing Hazelcast service):

  1. Specify the map in the hazelcast.xml file as follows:

       <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>
    

Once done, you can simply call the following from your Java app:

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

Now, you should be able to put/get values to and from the map as needed. You can use tcp or multicasting for replication based on your use case (use tcp if possible) and retrieve info from the second map for confirmation of data replication. Please also understand how data gets replicated across maps.

Hope it helps

分享给朋友:
您可能感兴趣的文章:
随机阅读: