public void run() throws CacheException { Cache cache = getCache(); PartitionedRegion partitionedregion = (PartitionedRegion) cache.getRegion(PR_PREFIX); PartitionedRegionDataStore dataStore = partitionedregion.getDataStore(); //there should only be 2 items in memory assertEquals(2 * oneItemSize, dataStore.currentAllocatedMemory()); //fault something else into memory and check again. partitionedregion.get(Long.valueOf(82 * totalNumBuckets)); assertEquals(2 * oneItemSize, dataStore.currentAllocatedMemory()); assertEquals(50 * oneItemSize, dataStore.getBucketSize(0)); } };
public void run() { Cache cache = getCache(); PartitionedRegion partitionedregion = (PartitionedRegion) cache.getRegion(PR_PREFIX); long bytes = partitionedregion.getDataStore().currentAllocatedMemory(); assertEquals(0, bytes); } });
public void run() throws CacheException { Cache cache = getCache(); PartitionedRegion partitionedregion = (PartitionedRegion) cache.getRegion(PR_PREFIX); PartitionedRegionDataStore dataStore = partitionedregion.getDataStore(); assertEquals(50 * oneItemSize, dataStore.currentAllocatedMemory()); } };
assertEquals(0, regionAck1.getDataStore().currentAllocatedMemory()); final int size1 = CachedDeserializableFactory.calcMemSize(storedVal); int size = size1; assertEquals(size, regionAck1.getDataStore().currentAllocatedMemory()); final int size2 = CachedDeserializableFactory.calcMemSize(storedVal); size += size2; assertEquals(size, regionAck1.getDataStore().currentAllocatedMemory()); final int size3 = CachedDeserializableFactory.calcMemSize(storedVal); size += size3; assertEquals(size, regionAck1.getDataStore().currentAllocatedMemory()); long beforeSize = regionAck1.getDataStore().currentAllocatedMemory(); regionAck1.invalidate(new Integer(3)); size -= size3; assertEquals("beforeSize=" + beforeSize + " expectedSize=" + size + " afterSize=" + regionAck1.getDataStore().currentAllocatedMemory(), size, regionAck1.getDataStore().currentAllocatedMemory()); assertEquals(size, regionAck1.getDataStore().currentAllocatedMemory()); regionAck1.destroy(new Integer(3)); assertEquals(size, regionAck1.getDataStore().currentAllocatedMemory()); assertEquals(size, regionAck1.getDataStore().currentAllocatedMemory()); regionAck1.destroy(new Integer(2)); assertEquals(size, regionAck1.getDataStore().currentAllocatedMemory());
public void run2() { Cache cache = getCache(); PartitionedRegion pr = (PartitionedRegion)cache .getRegion(Region.SEPARATOR + "testMemoryOfPartitionRegion" + 0); assertNotNull("pr can not be null", pr); assertNotNull("DataStore cannot be null", pr.getDataStore()); long prMemory = pr.getDataStore().currentAllocatedMemory(); innerPrPrefix = "createPRForStrorage"; PartitionedRegion prForStorage = (PartitionedRegion)cache .getRegion(Region.SEPARATOR + innerPrPrefix + 0); for (int i = innerStartIndexForKey; i < innerEndIndexForKey; i++) { prForStorage.put(new Long(i), new Long(prMemory)); } } };
private void initialize(PartitionedRegion region) { setNumberOfEntries(region.size()); // If there is a data store (meaning that the PR has storage // in this VM), get the number of entries and heap size. Else, // set these to 0. PartitionedRegionDataStore ds = region.getDataStore(); int numLocalEntries = 0; long heapSize = 0; if (ds != null) { CachePerfStats cpStats = ds.getCachePerfStats(); numLocalEntries = (int) cpStats.getEntries(); heapSize = ds.currentAllocatedMemory(); } setNumberOfLocalEntries(numLocalEntries); setHeapSize(heapSize); }
private void initialize(PartitionedRegion region) { setNumberOfEntries(region.size()); // If there is a data store (meaning that the PR has storage // in this VM), get the number of entries and heap size. Else, // set these to 0. PartitionedRegionDataStore ds = region.getDataStore(); int numLocalEntries = 0; long heapSize = 0; if (ds != null) { CachePerfStats cpStats = ds.getCachePerfStats(); numLocalEntries = (int) cpStats.getEntries(); heapSize = ds.currentAllocatedMemory(); } setNumberOfLocalEntries(numLocalEntries); setHeapSize(heapSize); }
while ((size = pr.getDataStore().currentAllocatedMemory()) < PartitionedRegionHelper.BYTES_PER_MB) { cache.getLogger().info("size: " + size); Object obj = new TestObject1("testObject1" + i, 10);