/** * Sets the attributes of the root region * * @throws RegionExistsException * If this cache already contains a region with the same * name as <code>root</code>. */ void addRootRegion(RegionCreation root) throws RegionExistsException { String name = root.getName(); RegionCreation existing = (RegionCreation) this.roots.get(name); if (existing != null) { throw new RegionExistsException(existing); } else { this.roots.put(root.getName(), root); } }
/** * Sets the attributes of the root region * * @throws RegionExistsException * If this cache already contains a region with the same * name as <code>root</code>. */ void addRootRegion(RegionCreation root) throws RegionExistsException { String name = root.getName(); RegionCreation existing = (RegionCreation) this.roots.get(name); if (existing != null) { throw new RegionExistsException(existing); } else { this.roots.put(root.getName(), root); } }
/** * After popping the current <code>RegionCreation</code> off the stack, if * the element on top of the stack is a <code>RegionCreation</code>, then * it is the parent region. */ private void endRegion() throws RegionExistsException { RegionCreation region = (RegionCreation) stack.pop(); boolean isRoot = false; if (stack.isEmpty()) { isRoot = true; } else if (!(stack.peek() instanceof RegionCreation)) { isRoot = true; } if (isRoot) { this.cache.addRootRegion(region); } else { RegionCreation parent = (RegionCreation) stack.peek(); parent.addSubregion(region.getName(), region); } }
/** * After popping the current <code>RegionCreation</code> off the stack, if * the element on top of the stack is a <code>RegionCreation</code>, then * it is the parent region. */ private void endRegion() throws RegionExistsException { RegionCreation region = (RegionCreation) stack.pop(); boolean isRoot = false; if (stack.isEmpty()) { isRoot = true; } else if (!(stack.peek() instanceof RegionCreation)) { isRoot = true; } if (isRoot) { this.cache.addRootRegion(region); } else { RegionCreation parent = (RegionCreation) stack.peek(); parent.addSubregion(region.getName(), region); } }
/** * Returns whether or not this <code>RegionCreation</code> is * equivalent to another <code>Region</code>. */ public boolean sameAs(Region other) { if (other == null) { return false; } if (!this.getName().equals(other.getName())) { throw new RuntimeException(LocalizedStrings.RegionCreation_REGION_NAMES_DIFFER_THIS_0_OTHER_1.toLocalizedString(new Object[] {this.getName(), other.getName()})); } if (!this.attrs.sameAs(other.getAttributes())) { throw new RuntimeException(LocalizedStrings.RegionCreation_REGION_ATTRIBUTES_DIFFER_THIS_0_OTHER_1.toLocalizedString(new Object[] {this.attrs, other.getAttributes()})); } Collection myEntries = this.basicEntries(false); Collection otherEntries = ((LocalRegion)other).basicEntries(false); if (myEntries.size() != otherEntries.size()) { return false; } for (Iterator iter = myEntries.iterator(); iter.hasNext(); ) { Region.Entry myEntry = (Region.Entry) iter.next(); Region.Entry otherEntry = other.getEntry(myEntry.getKey()); if (otherEntry == null) { return false; } else if (!myEntry.getValue().equals(otherEntry.getValue())) { return false; } } return true; }
/** * Returns whether or not this <code>RegionCreation</code> is * equivalent to another <code>Region</code>. */ public boolean sameAs(Region other) { if (other == null) { return false; } if (!this.getName().equals(other.getName())) { throw new RuntimeException(LocalizedStrings.RegionCreation_REGION_NAMES_DIFFER_THIS_0_OTHER_1.toLocalizedString(new Object[] {this.getName(), other.getName()})); } if (!this.attrs.sameAs(other.getAttributes())) { throw new RuntimeException(LocalizedStrings.RegionCreation_REGION_ATTRIBUTES_DIFFER_THIS_0_OTHER_1.toLocalizedString(new Object[] {this.attrs, other.getAttributes()})); } Collection myEntries = this.basicEntries(false); Collection otherEntries = ((LocalRegion)other).basicEntries(false); if (myEntries.size() != otherEntries.size()) { return false; } for (Iterator iter = myEntries.iterator(); iter.hasNext(); ) { Region.Entry myEntry = (Region.Entry) iter.next(); Region.Entry otherEntry = other.getEntry(myEntry.getKey()); if (otherEntry == null) { return false; } else if (!myEntry.getValue().equals(otherEntry.getValue())) { return false; } } return true; }
while (it.hasNext()) { RegionCreation r = (RegionCreation)it.next(); Region r2 = other.getRegion(r.getName()); if (r2 == null) { throw new RuntimeException(LocalizedStrings.CacheCreation_NO_ROOT_0.toLocalizedString(r.getName())); } else if (!r.sameAs(r2)) { throw new RuntimeException(LocalizedStrings.CacheCreation_REGIONS_DIFFER.toLocalizedString());
while (it.hasNext()) { RegionCreation r = (RegionCreation)it.next(); Region r2 = other.getRegion(r.getName()); if (r2 == null) { throw new RuntimeException(LocalizedStrings.CacheCreation_NO_ROOT_0.toLocalizedString(r.getName())); } else if (!r.sameAs(r2)) { throw new RuntimeException(LocalizedStrings.CacheCreation_REGIONS_DIFFER.toLocalizedString());
getCache().getLoggerI18n().warning( LocalizedStrings.Mem_LRU_Eviction_Attribute_Reset, new Object[] { this.getName(), attrs.getEvictionAttributes().getMaximum(), attrs.getPartitionAttributes().getLocalMaxMemory() });
new Object[] { this.getName(), attrs.getEvictionAttributes().getMaximum(), attrs.getPartitionAttributes().getLocalMaxMemory() });