Hello! You can use ignite.countDownLatch(). I believe we've already discussed this approach.
Regards, -- Ilya Kasnacheev 2018-07-24 18:14 GMT+03:00 monstereo <[email protected]>: > ?? > > monstereo wrote > > thank you, > > As you stated, it is about my memory configuration, I solved it. (When I > > increase the memory) > > > > But can you explain external synch. part for " "cache is not ready" if > the > > cache is already created but not populated yet. You need external sync > > here." > > > > Which method ignite provides for this "cache is not ready". (I am looking > > for -> "client can not run the get method, until cache is ready.") > > > > > > ilya.kasnacheev wrote > >> Hello! > >> > >> Can you please provide the thread dump while running this code? > >> > >> Note that 10M is a very very small number for a memory model and it > might > >> affect your case. > >> > >> Also note that cache.get() should absolutely not return "cache is not > >> ready" if the cache is already created but not populated yet. You need > >> external sync here. > >> > >> Regards, > >> > >> > >> -- > >> Ilya Kasnacheev > >> > >> 2018-07-23 11:22 GMT+03:00 monstereo < > > > >> mehmetozanguven@ > > > >> >: > >> > >>> Here is the config file: > >>> > >> > > <property name="dataStorageConfiguration"> > >>> > >> > > <bean > >> > >> > >> class="org.apache.ignite.configuration.DataStorageConfiguration"> > >>> > >> > > <property name="dataRegionConfigurations"> > >>> > >> > > <list> > >>> > >> > > <bean > >> > >> > >> class="org.apache.ignite.configuration.DataRegionConfiguration"> > >>> > >> > > <property name="name" value="10MB_Region"/> > >>> > >> > > <property name="initialSize" > >> > >> > >> value="#{10L*1024*1024}"/> > >>> > >> > > <property name="maxSize" > >> > >> > >> value="#{10L*1024*1024}"/> > >>> > >> > > <property name="pageEvictionMode" > >> > >> > >> value="RANDOM_2_LRU"/> > >>> > >> > > <property name="evictionThreshold" > >> > >> > >> value="0.5"/> > >>> > >> > > </bean> > >>> > >> > > </list> > >>> > >> > > </property> > >>> > >> > > </bean> > >>> > >> > > </property> > >>> > >>> > >> > > <property name="cacheConfiguration"> > >>> > >> > > <bean > >> > >> > >> class="org.apache.ignite.configuration.CacheConfiguration"> > >>> > >>> > >> > > <property name="name" value="testCache"/> > >>> > >>> > >> > > <property name="cacheMode" value="REPLICATED"/> > >>> > >>> > >> > > <property name="dataRegionName" value="10MB_Region"/> > >>> > >> > > </bean> > >>> > >> > > </property> > >>> > >>> > >>> Here is the main app > >>> public static void populateCache(IgniteCache igniteCache){ > >>> for (int i = 0; i < 10; i++){ > >>> igniteCache.put(i, String.valueOf(i)); > >>> } > >>> } > >>> > >>> public static void main(String[] args) { > >>> Ignite igniteNode = > >>> IgniteFactory.createIgniteNodeWithSpecificConfiguration("s", > >>> configPath); > >>> IgniteConfiguration igniteConfiguration = > >>> igniteNode.configuration(); > >>> IgniteCache igniteCache = igniteNode.getOrCreateCache(" > >>> testCache"); > >>> populateCache(igniteCache); > >>> System.out.println(igniteCache.size()); > >>> > >>> } > >>> > >>> when i changed to i<7000 (in populateCache method), server node > >>> appears(I > >>> mean, i can see "[11:13:09] Topology snapshot [ver=1, servers=1, > >>> clients=0, > >>> CPUs=4, offheap=1.2GB, heap=1.3GB]") but too wait to write > >>> System.out.println(igniteCache.size()); > >>> > >>> Now at the same time I have created client node : > >>> > >>> Ignite client = > >>> IgniteFactory.createIgniteNodeWithSpecificConfiguration("c", > cluster_1); > >>> IgniteCache igniteCache = client.getOrCreateCache(" > testCache"); > >>> System.out.println(igniteCache.get(6999)); > >>> > >>> this returns null, > >>> > >>> it should not return null -> it should return:: > >>> * cache is not ready > >>> * or wait until cache is ready and get the result which is 6999 > >>> > >>> > >>> > >>> -- > >>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/ > >>> > > > > > > > > > > > > -- > > Sent from: http://apache-ignite-users.70518.x6.nabble.com/ > > > > > > -- > Sent from: http://apache-ignite-users.70518.x6.nabble.com/ >
