Reputation: 20182
I am using hazelcast (v2.1.3) - in the storeload for the map, "store" keeps getting invoked instead of "store all" (even though the write delay seconds flag is greater than 0):
<map-store enabled="true">
<class-name>test.test.abcMap</class-name>
<write-delay-seconds>5</write-delay-seconds>
</map-store>
Any useful suggestions to help troubleshoot this would be quite welcome. I had asynch write behinds working on a different project but cannot seem to get them working right now. Thanks
Edit After the delay specified in the write-delay-seconds, the store implementation gets invoked (as opposed to the store all).
Upvotes: 0
Views: 622
Reputation: 91
Are you sure you have more than one entry that needs to be stored?
If only one entry in the map has been added or updated, MapStore.store(key, value)
will be called even if you have write-behind enabled. MapStore.storeAll(map)
will only be called if more than one entry needs to be stored.
Here's the relevant code from com.hazelcast.impl.CMap.runStoreUpdate()
(the member store
is of type MapStore
):
if (updates.size() == 1) {
Map.Entry entry = updates.entrySet().iterator().next();
store.store(entry.getKey(), entry.getValue());
} else if (updates.size() > 1) {
store.storeAll(updates);
}
The same applies to MapStore.delete()
and MapStore.deleteAll()
.
You can see this code in context in the Hazelcast source at Github
Upvotes: 2