private void validatePartitionListeners(final PartitionRegionConfig prconf, final PartitionAttributes userPA) { ArrayList<String> prconfList = prconf.getPartitionListenerClassNames(); if (userPA.getPartitionListeners() == null && userPA.getPartitionListeners().length == 0 && prconfList != null) { throw new IllegalStateException( LocalizedStrings.PartitionRegionConfigValidator_INCOMPATIBLE_PARTITION_LISTENER .toLocalizedString(new Object[] { null, prconfList })); } if (userPA.getPartitionListeners() != null && prconfList != null) { ArrayList<String> userPRList = new ArrayList<String>(); for (int i = 0; i < userPA.getPartitionListeners().length; i++) { userPRList.add(userPA.getPartitionListeners()[i].getClass().getName()); } if (userPA.getPartitionListeners().length != prconfList.size()) { throw new IllegalStateException( LocalizedStrings.PartitionRegionConfigValidator_INCOMPATIBLE_PARTITION_LISTENER .toLocalizedString(new Object[] { userPRList, prconfList })); } for (String listener : prconfList) { if (!(userPRList.contains(listener))) { throw new IllegalStateException( LocalizedStrings.PartitionRegionConfigValidator_INCOMPATIBLE_PARTITION_LISTENER .toLocalizedString(new Object[] { userPRList, prconfList })); } } } }
private void validatePartitionListeners(final PartitionRegionConfig prconf, final PartitionAttributes userPA) { ArrayList<String> prconfList = prconf.getPartitionListenerClassNames(); if (userPA.getPartitionListeners() == null && userPA.getPartitionListeners().length == 0 && prconfList != null) { throw new IllegalStateException( LocalizedStrings.PartitionRegionConfigValidator_INCOMPATIBLE_PARTITION_LISTENER .toLocalizedString(new Object[] { null, prconfList })); } if (userPA.getPartitionListeners() != null && prconfList != null) { ArrayList<String> userPRList = new ArrayList<String>(); for (int i = 0; i < userPA.getPartitionListeners().length; i++) { userPRList.add(userPA.getPartitionListeners()[i].getClass().getName()); } if (userPA.getPartitionListeners().length != prconfList.size()) { throw new IllegalStateException( LocalizedStrings.PartitionRegionConfigValidator_INCOMPATIBLE_PARTITION_LISTENER .toLocalizedString(new Object[] { userPRList, prconfList })); } for (String listener : prconfList) { if (!(userPRList.contains(listener))) { throw new IllegalStateException( LocalizedStrings.PartitionRegionConfigValidator_INCOMPATIBLE_PARTITION_LISTENER .toLocalizedString(new Object[] { userPRList, prconfList })); } } } }
/** * Constructor. */ PartitionRegionConfig(int prId, String path, PartitionAttributes prAtt, Scope sc) { this.prId = prId; this.pAttrs = (PartitionAttributesImpl)prAtt; this.scope = sc; this.isDestroying = false; this.nodes = new VersionedArrayList(); if (prAtt.getPartitionResolver() != null) { this.partitionResolver = prAtt.getPartitionResolver().getClass().getName(); } this.colocatedWith = prAtt.getColocatedWith(); this.isColocationComplete = colocatedWith == null; this.fullPath = path; this.firstDataStoreCreated = prAtt.getLocalMaxMemory() != 0; this.elderFPAs = new LinkedHashSet<FixedPartitionAttributesImpl>(); PartitionListener[] prListeners = prAtt.getPartitionListeners(); if (prListeners != null && prListeners.length != 0) { for (int i = 0; i < prListeners.length; i++) { PartitionListener listener = prListeners[i]; this.partitionListenerClassNames.add(listener.getClass().getName()); } } }
/** * 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(); }
/** * Constructor. */ PartitionRegionConfig(int prId, String path, PartitionAttributes prAtt, Scope sc) { this.prId = prId; this.pAttrs = (PartitionAttributesImpl)prAtt; this.scope = sc; this.isDestroying = false; this.nodes = new VersionedArrayList(); if (prAtt.getPartitionResolver() != null) { this.partitionResolver = prAtt.getPartitionResolver().getClass().getName(); } this.colocatedWith = prAtt.getColocatedWith(); this.isColocationComplete = colocatedWith == null; this.fullPath = path; this.firstDataStoreCreated = prAtt.getLocalMaxMemory() > 0; this.elderFPAs = new LinkedHashSet<FixedPartitionAttributesImpl>(); PartitionListener[] prListeners = prAtt.getPartitionListeners(); if (prListeners != null && prListeners.length != 0) { for (int i = 0; i < prListeners.length; i++) { PartitionListener listener = prListeners[i]; this.partitionListenerClassNames.add(listener.getClass().getName()); } } }
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; }
this.fullPath = path; this.elderFPAs = new LinkedHashSet<FixedPartitionAttributesImpl>(); PartitionListener[] prListeners = prAtt.getPartitionListeners(); if (prListeners != null && prListeners.length != 0) { for (int i = 0; i < prListeners.length; i++) {
this.fullPath = path; this.elderFPAs = new LinkedHashSet<FixedPartitionAttributesImpl>(); PartitionListener[] prListeners = prAtt.getPartitionListeners(); if (prListeners != null && prListeners.length != 0) { for (int i = 0; i < prListeners.length; i++) {
public Object call() { Cache cache = getCache(); Region region = cache.getRegion(regionName); TestPartitionListener listener = (TestPartitionListener) region.getAttributes().getPartitionAttributes().getPartitionListeners()[0]; return listener.getBucketsAndKeysRemoved(); } };
public Object call() { Cache cache = getCache(); Region region = cache.getRegion(regionName); TestPartitionListener listener = (TestPartitionListener) region.getAttributes().getPartitionAttributes().getPartitionListeners()[0]; return listener.getBucketsAndKeysAdded(); } };
PartitionListener[] listArr = info.prAttr.getPartitionListeners(); List aList = new ArrayList(); for (PartitionListener listener: listArr) {
&& pa.getPartitionListeners().length == 0 && (pa.getFixedPartitionAttributes() == null || pa.getFixedPartitionAttributes().isEmpty())) { return; PartitionListener[] listeners = pa.getPartitionListeners(); for (int i = 0; i < listeners.length; i++) { PartitionListener listener = listeners[i];
&& pa.getPartitionListeners().length == 0 && (pa.getFixedPartitionAttributes() == null || pa.getFixedPartitionAttributes().isEmpty())) { return; PartitionListener[] listeners = pa.getPartitionListeners(); for (int i = 0; i < listeners.length; i++) { PartitionListener listener = listeners[i];
assertEquals(startupRecoveryDelay, data.getStartupRecoveryDelay()); if (partAttrs.getPartitionListeners() != null) { for (int i = 0; i < partAttrs.getPartitionListeners().length; i++) { assertEquals((partAttrs.getPartitionListeners())[i].getClass() .getCanonicalName(), data.getPartitionListeners()[i]);
this.partitionListeners = this.partitionAttributes.getPartitionListeners();
this.partitionListeners = this.partitionAttributes.getPartitionListeners();