Package com.hazelcast.map.impl

Examples of com.hazelcast.map.impl.NearCache


                Assert.assertNotNull(m.get(i));
            }
        }

        for (HazelcastInstance instance : instances) {
            NearCache nearCache = getNearCache(mapName, instance);
            int size = nearCache.size();
            assertTrue("NearCache Size: " + size, size > 0);
        }

        map.clear();
        for (HazelcastInstance instance : instances) {
            NearCache nearCache = getNearCache(mapName, instance);
            int size = nearCache.size();
            assertEquals(0, size);
        }

    }
View Full Code Here


            }
        });
    }

    private int countNotNullValuesInNearCache(String mapName, HazelcastInstance instance) {
        final NearCache nearCache = getNearCache(mapName, instance);
        final Collection<NearCache.CacheRecord> values = nearCache.getReadonlyMap().values();
        int count = 0;
        for (NearCache.CacheRecord e : values) {
            if (!NearCache.NULL_OBJECT.equals(e.getValue())) {
                count++;
            }
View Full Code Here

        //populate the near cache
        for (int i = 0; i < count; i++) {
            map.get(i);
        }

        final NearCache nearCache = getNearCache(mapName, instances[0]);
        assertTrue(nearCache.size() > (count / n - count * 0.1)); //more-or-less (count / no_of_nodes) should be in the near cache now

        Map<Object, Object> invalidationMap = new HashMap<Object, Object>(count);
        for (int i = 0; i < count; i++) {
            invalidationMap.put(i, i);
        }
        map.putAll(invalidationMap); //this should invalidate the near cache

        assertTrueEventually(
                new AssertTask() {
                    @Override
                    public void run() {
                        assertEquals("Invalidation is not working on putAll()", 0, nearCache.size());
                    }
                }
        );
    }
View Full Code Here

        //warm-up cache
        for (int i = 0; i < noOfEntries; i++) {
            map.get("key" + i);
        }

        NearCache nearCache = getNearCache(mapName, instance);
        assertEquals(noOfEntries, nearCache.size());
    }
View Full Code Here

TOP

Related Classes of com.hazelcast.map.impl.NearCache

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.