/** * Returns the partition attributes as a string. For use only by {@link * RegionDescription#partitionAttributesToString(PartitionAttributes)}. */ protected static synchronized String partitionAttributesToString( PartitionAttributes p) { if (p == null) { return "null"; } StringBuffer buf = new StringBuffer(); buf.append("\n colocatedWith: " + p.getColocatedWith()); buf.append("\n fixedPartitionAttributes: " + p.getFixedPartitionAttributes()); buf.append("\n localMaxMemory: " + p.getLocalMaxMemory()); buf.append("\n partitionListeners: " + Arrays.toString(p.getPartitionListeners())); buf.append("\n partitionResolver: " + p.getPartitionResolver()); buf.append("\n recoveryDelay: " + p.getRecoveryDelay()); buf.append("\n redundantCopies: " + p.getRedundantCopies()); buf.append("\n startupRecoveryDelay: " + p.getStartupRecoveryDelay()); buf.append("\n totalMaxMemory: " + p.getTotalMaxMemory()); buf.append("\n totalNumBuckets: " + p.getTotalNumBuckets()); return buf.toString(); }
/** * Resets the partition description based on partition attributes, to pick up * product defaults and side-effects. */ private static void resetPartitionDescription(PartitionDescription pd, PartitionAttributes pa) { if (pd.getLocalMaxMemory() != null) { pd.setLocalMaxMemory(new Integer(pa.getLocalMaxMemory())); } // else deferred pd.setRecoveryDelay(new Long(pa.getRecoveryDelay())); pd.setRedundantCopies(new Integer(pa.getRedundantCopies())); pd.setStartupRecoveryDelay(new Long(pa.getStartupRecoveryDelay())); pd.setTotalMaxMemory(new Long(pa.getTotalMaxMemory())); pd.setTotalNumBuckets(new Integer(pa.getTotalNumBuckets())); }
expectedValue = info.prAttr.getTotalMaxMemory(); verifyValue(expectedValue, methodName, attr, null); expectedInToString.add("totalMaxMemory=" + expectedValue);
public void run2() throws CacheException { final Cache c; try { CacheXml30Test.lonerDistributedSystem = false; c = getCache(); } finally { CacheXml30Test.lonerDistributedSystem = true; } Region r = c.getRegion(regionName); assertNotNull(r); RegionAttributes attrs = r.getAttributes(); assertNotNull(attrs.getPartitionAttributes()); PartitionAttributes pa = attrs.getPartitionAttributes(); assertEquals(pa.getRedundantCopies(), 1); assertEquals(pa.getLocalMaxMemory(), 32); assertEquals(pa.getTotalMaxMemory(), 96); assertEquals(pa.getTotalNumBuckets(), 119); r = c.getRegion("bug37905"); assertTrue("region should have been an instance of PartitionedRegion but was not", r instanceof PartitionedRegion); } };
atts.addAttribute("", "", LOCAL_MAX_MEMORY, "", String.valueOf(pa.getLocalMaxMemory())); if (generateDefaults() || pa.getTotalMaxMemory() != PartitionAttributesFactory.GLOBAL_MAX_MEMORY_DEFAULT) atts.addAttribute("", "", TOTAL_MAX_MEMORY, "", String.valueOf(pa.getTotalMaxMemory())); if (generateDefaults() || pa.getTotalNumBuckets() != PartitionAttributesFactory.GLOBAL_MAX_BUCKETS_DEFAULT) atts.addAttribute("", "", TOTAL_NUM_BUCKETS, "",
atts.addAttribute("", "", LOCAL_MAX_MEMORY, "", String.valueOf(pa.getLocalMaxMemory())); if (generateDefaults() || pa.getTotalMaxMemory() != PartitionAttributesFactory.GLOBAL_MAX_MEMORY_DEFAULT) atts.addAttribute("", "", TOTAL_MAX_MEMORY, "", String.valueOf(pa.getTotalMaxMemory())); if (generateDefaults() || pa.getTotalNumBuckets() != PartitionAttributesFactory.GLOBAL_MAX_BUCKETS_DEFAULT) atts.addAttribute("", "", TOTAL_NUM_BUCKETS, "",
public static PartitionAttributesData getPartitionAttributesData(PartitionAttributes partAttrs) { int redundantCopies = partAttrs.getRedundantCopies(); long totalMaxMemory = partAttrs.getTotalMaxMemory(); // Total number of buckets for whole region int totalNumBuckets = partAttrs.getTotalNumBuckets(); int localMaxMemory = partAttrs.getLocalMaxMemory(); String colocatedWith = partAttrs.getColocatedWith(); String partitionResolver = null; if (partAttrs.getPartitionResolver() != null) { partitionResolver = partAttrs.getPartitionResolver().getName(); } long recoveryDelay = partAttrs.getRecoveryDelay(); long startupRecoveryDelay = partAttrs.getStartupRecoveryDelay(); String[] partitionListeners = null; if (partAttrs.getPartitionListeners() != null) { partitionListeners = new String[partAttrs.getPartitionListeners().length]; for (int i = 0; i < partAttrs.getPartitionListeners().length; i++) { partitionListeners[i] = (partAttrs.getPartitionListeners())[i].getClass().getCanonicalName(); } } PartitionAttributesData partitionAttributesData = new PartitionAttributesData(redundantCopies, totalMaxMemory, totalNumBuckets, localMaxMemory, colocatedWith, partitionResolver, recoveryDelay, startupRecoveryDelay, partitionListeners); return partitionAttributesData; }
public static PartitionAttributesData getPartitionAttributesData(PartitionAttributes partAttrs) { int redundantCopies = partAttrs.getRedundantCopies(); long totalMaxMemory = partAttrs.getTotalMaxMemory(); // Total number of buckets for whole region int totalNumBuckets = partAttrs.getTotalNumBuckets(); int localMaxMemory = partAttrs.getLocalMaxMemory(); String colocatedWith = partAttrs.getColocatedWith(); String partitionResolver = null; if (partAttrs.getPartitionResolver() != null) { partitionResolver = partAttrs.getPartitionResolver().getName(); } long recoveryDelay = partAttrs.getRecoveryDelay(); long startupRecoveryDelay = partAttrs.getStartupRecoveryDelay(); String[] partitionListeners = null; if (partAttrs.getPartitionListeners() != null) { partitionListeners = new String[partAttrs.getPartitionListeners().length]; for (int i = 0; i < partAttrs.getPartitionListeners().length; i++) { partitionListeners[i] = (partAttrs.getPartitionListeners())[i].getClass().getCanonicalName(); } } PartitionAttributesData partitionAttributesData = new PartitionAttributesData(redundantCopies, totalMaxMemory, totalNumBuckets, localMaxMemory, colocatedWith, partitionResolver, recoveryDelay, startupRecoveryDelay, partitionListeners); return partitionAttributesData; }
assertEquals(r.getAttributes().getPartitionAttributes().getRedundantCopies(),1); assertEquals(r.getAttributes().getPartitionAttributes().getLocalMaxMemory(),100); assertEquals(r.getAttributes().getPartitionAttributes().getTotalMaxMemory(),500); assertEquals(r.getAttributes().getPartitionAttributes().getPartitionResolver(),partitionResolver); assertEquals(pa.getTotalMaxMemory(), 500); assertNotNull(pa.getPartitionResolver().getClass()); assertEquals(pa.getPartitionResolver(), partitionResolver);
if (pa.getTotalMaxMemory() <= 0) { throw new IllegalStateException(LocalizedStrings.AttributesFactory_TOTAL_SIZE_OF_PARTITION_REGION_MUST_BE_0.toLocalizedString());
long totalMaxMemory = partAttrs.getTotalMaxMemory(); assertEquals(totalMaxMemory, data.getTotalMaxMemory());
@SuppressWarnings("unchecked") public void setAll(@SuppressWarnings("rawtypes") PartitionAttributes pa) { setRedundantCopies(pa.getRedundantCopies()); setLocalProperties(pa.getLocalProperties()); setGlobalProperties(pa.getGlobalProperties()); setLocalMaxMemory(pa.getLocalMaxMemory()); setTotalMaxMemory(pa.getTotalMaxMemory()); setTotalNumBuckets(pa.getTotalNumBuckets()); setPartitionResolver(pa.getPartitionResolver()); setColocatedWith(pa.getColocatedWith()); setRecoveryDelay(pa.getRecoveryDelay()); setStartupRecoveryDelay(pa.getStartupRecoveryDelay()); setEnableOffHeapMemory(((PartitionAttributesImpl) pa).getEnableOffHeapMemory()); addFixedPartitionAttributes(pa.getFixedPartitionAttributes()); }
@SuppressWarnings("unchecked") public void setAll(@SuppressWarnings("rawtypes") PartitionAttributes pa) { setRedundantCopies(pa.getRedundantCopies()); setLocalProperties(pa.getLocalProperties()); setGlobalProperties(pa.getGlobalProperties()); setLocalMaxMemory(pa.getLocalMaxMemory()); setTotalMaxMemory(pa.getTotalMaxMemory()); setTotalNumBuckets(pa.getTotalNumBuckets()); setPartitionResolver(pa.getPartitionResolver()); setColocatedWith(pa.getColocatedWith()); setRecoveryDelay(pa.getRecoveryDelay()); setStartupRecoveryDelay(pa.getStartupRecoveryDelay()); setOffHeap(((PartitionAttributesImpl) pa).getOffHeap()); addFixedPartitionAttributes(pa.getFixedPartitionAttributes()); }
part.toalMaxMemory = region.getPartitionAttributes().getTotalMaxMemory(); pai.addPartition(part);
assertEquals(r.getAttributes().getPartitionAttributes().getRedundantCopies(),1); assertEquals(r.getAttributes().getPartitionAttributes().getLocalMaxMemory(),100); assertEquals(r.getAttributes().getPartitionAttributes().getTotalMaxMemory(),500); assertEquals(r.getAttributes().getPartitionAttributes().getPartitionResolver(),partitionResolver); assertEquals(pa.getTotalMaxMemory(), 500); assertNotNull(pa.getPartitionResolver().getClass()); assertEquals(pa.getPartitionResolver(), partitionResolver);
assertEquals(r.getAttributes().getPartitionAttributes().getRedundantCopies(),redundantCopies); assertEquals(r.getAttributes().getPartitionAttributes().getLocalMaxMemory(),100); assertEquals(r.getAttributes().getPartitionAttributes().getTotalMaxMemory(),500); assertEquals(r.getAttributes().getPartitionAttributes().getPartitionResolver(),partitionResolver); assertEquals(pa.getTotalMaxMemory(), 500); assertNotNull(pa.getPartitionResolver().getClass()); assertEquals(pa.getPartitionResolver(), partitionResolver);
assertEquals(r.getAttributes().getPartitionAttributes().getRedundantCopies(),1); assertEquals(r.getAttributes().getPartitionAttributes().getLocalMaxMemory(),100); assertEquals(r.getAttributes().getPartitionAttributes().getTotalMaxMemory(),500); assertEquals(-1, r.getAttributes().getPartitionAttributes().getRecoveryDelay()); assertEquals(0, r.getAttributes().getPartitionAttributes().getStartupRecoveryDelay()); assertEquals(pa.getTotalMaxMemory(), 500); assertEquals(-1, r.getAttributes().getPartitionAttributes().getRecoveryDelay()); assertEquals(0, r.getAttributes().getPartitionAttributes().getStartupRecoveryDelay());
assertEquals(r.getAttributes().getPartitionAttributes().getRedundantCopies(),1); assertEquals(r.getAttributes().getPartitionAttributes().getLocalMaxMemory(),100); assertEquals(r.getAttributes().getPartitionAttributes().getTotalMaxMemory(),500); assertEquals(33, r.getAttributes().getPartitionAttributes().getRecoveryDelay()); assertEquals(270, r.getAttributes().getPartitionAttributes().getStartupRecoveryDelay()); assertEquals(pa.getTotalMaxMemory(), 500); assertEquals(33, r.getAttributes().getPartitionAttributes().getRecoveryDelay()); assertEquals(270, r.getAttributes().getPartitionAttributes().getStartupRecoveryDelay());
assertEquals(pa.getTotalMaxMemory(), 500);
assertEquals(pa.getTotalMaxMemory(), 500);