user3813256
user3813256

Reputation:

hazelcast store load not being called

I am using hazelcast 3.2.3. I added a class Test1 which is being stored in a hazelcast map Test1Map (IMap). I added a class called Test1StoreLoad which implements the store/load/delete calls. In the load all keys implementation, I am loading the relevant keys from the database using JDBC. I was under the impression that once my application is started and I get a reference to the map for the first time, the load/store implementation will get invoked thereby calling the loadAll functionality. However, this is not happeneing (the loadAll is not getting called at all). What else can be done to debug this?

I added the following config in the xml file for the store load implementation:

<map name="Test1Map">
<in-memory-format>BINARY</in-memory-format>
<backup-count>0</backup-count>
<async-backup-count>1</async-backup-count>
<time-to-live-seconds>0</time-to-live-seconds>
<max-idle-seconds>0</max-idle-seconds>
<eviction-policy>LRU</eviction-policy>
<max-size policy="PER_NODE">0</max-size>
<eviction-percentage>25</eviction-percentage>
   <map-store enabled="true">
    <class-name>models.hcast.storeload.Test1StoreLoad</class-name>
    <write-delay-seconds>0</write-delay-seconds>
</map-store>

Can we change the EAGER/LAZY option for loading data via the XML config instead of the API?

Upvotes: 1

Views: 712

Answers (1)

user3813256
user3813256

Reputation:

I used the following to load my config file. Even though I had the classpath pointing to the folder containing the xml config file, for some reason (my lack of understanding or misconfiguration), the xml file was not getting picked (and probably the hazelcast-default.xml file was being picked). I switched to the FileSystemXmlConfig by passing in the location of the file (I did not want to add system properties but will look into it).

Here is what I tried.

HazelcastInstance hcast = null;
try {
    Config config = new FileSystemXmlConfig("C:/Users/username/workspace/HazelcastTest/config/hazelcast.xml");
    hcast= Hazelcast.newHazelcastInstance(config);
}
catch (FileNotFoundException e) {
    logger.error("file cannot be found exception");
}

Upvotes: 1

Related Questions