We use Hazelcast 2.3.1, in our hazelcast.xml configuration file we use the entry for Hazelcast IMap:
<map name="HazelcastObjectOperations.objectMap"> <backup-count>1</backup-count> <map-store enabled="true"> <class-name>persister.HazelcastObjectPersister</class-name> <write-delay-seconds>10</write-delay-seconds> </map-store> </map> <properties> <property name="hazelcast.map.cleanup.delay.seconds">5</property> </properties>
We got two classes
HazelcastObjectOperation , which contains the display and is used to place objects in it.HazelcastObjectPersister , which extends MapStore, is used to save objects when Hazelcast calls storeAll() .
public class HazelcastObjectOperation { protected final IMap<Long, MyHzcObj> objectMap; private final HazelcastInstance instance; public HazelcastObjectOperation() { this.instance = Hazelcast.getDefaultInstance(); this.objectMap = this.instance.getMap( "HazelcastObjectOperations.objectMap" ); } public void save( final MyHzcObj object ) { long start = System.currentTimeMillis(); IdGenerator generator = Hazelcast.getIdGenerator("generator"); this.objectMap.put( generator.newId(), object ); long end = System.currentTimeMillis(); } }
The problem is that Hazelcast goes through this card and selects the objects that should be stored in the storeAll method of the persister class, the card is locked for a few seconds, and therefore is placed on this card. this time. Is there a solution to this problem?
source share