@Override public int compare(PartitionedRegion o1, PartitionedRegion o2) { if (o1.isShadowPR() == o2.isShadowPR()) { return o1.getFullPath().compareTo(o2.getFullPath()); } if (o1.isShadowPR()) { return 1; } return -1; } });
public void shadowPRWaitForBucketRecovery() { assert this.isShadowPR(); PartitionedRegion userPR = ColocationHelper.getLeaderRegion(this); boolean isAccessor = (userPR.getLocalMaxMemory() == 0);
/** * Return all of the user PR buckets for this bucket region queue. */ public Collection<BucketRegion> getCorrespondingUserPRBuckets() { List<BucketRegion> userPRBuckets = new ArrayList<BucketRegion>(4); Map<String, PartitionedRegion> colocatedPRs = ColocationHelper.getAllColocationRegions(getPartitionedRegion()); for (PartitionedRegion colocatedPR : colocatedPRs.values()) { if (!colocatedPR.isShadowPR() && isThisSenderAttached(colocatedPR)) { BucketRegion parentBucket = colocatedPR.getDataStore().getLocalBucketById(getId()); if (parentBucket != null) userPRBuckets.add(parentBucket); } } return userPRBuckets; }
protected void clearAllTempQueueForShadowPR(final int bucketId) { List<PartitionedRegion> colocatedWithList = ColocationHelper.getColocatedChildRegions(partitionedRegion); for (PartitionedRegion childRegion : colocatedWithList) { if (childRegion.isShadowPR()) { AbstractGatewaySender sender = childRegion.getParallelGatewaySender(); if (sender == null) { return; } AbstractGatewaySenderEventProcessor eventProcessor = sender.getEventProcessor(); if (eventProcessor == null) { return; } ConcurrentParallelGatewaySenderQueue queue = (ConcurrentParallelGatewaySenderQueue) eventProcessor.getQueue(); if (queue == null) { return; } BlockingQueue<GatewaySenderEventImpl> tempQueue = queue.getBucketTmpQueue(bucketId); if (tempQueue != null) { synchronized (tempQueue) { for (GatewaySenderEventImpl event : tempQueue) { event.release(); } tempQueue.clear(); } } } } }
if (!this.prRegion.isShadowPR() && !ColocationHelper.checkMembersColocation(this.prRegion, candidate)) { if (isDebugEnabled) {
@Override protected Profile instantiateProfile(InternalDistributedMember memberId, int version) { if (!this.pRegion.isShadowPR()) { InternalCache cache = getProxyBucketRegion().getCache(); List servers = null; servers = cache.getCacheServers(); HashSet<BucketServerLocation66> serverLocations = new HashSet<BucketServerLocation66>(); for (Object object : servers) { CacheServerImpl server = (CacheServerImpl) object; if (server.isRunning() && (server.getExternalAddress() != null)) { BucketServerLocation66 location = new BucketServerLocation66(getBucket().getId(), server.getPort(), server.getExternalAddress() /* .getExternalAddress(false/ checkServerRunning ) */, getBucket().isPrimary(), Integer.valueOf(version).byteValue(), server.getCombinedGroups()); serverLocations.add(location); } } if (serverLocations.size() > 0) { return new ServerBucketProfile(memberId, version, getBucket(), serverLocations); } } return new BucketProfile(memberId, version, getBucket()); }
&& buk.getPartitionedRegion().isShadowPR()) { if (buk.getPartitionedRegion().getColocatedWithRegion() != null) { buk.getPartitionedRegion().getColocatedWithRegion().getRegionAdvisor()
if (bucketRegion.getPartitionedRegion().isShadowPR()) { if (bucketRegion.getPartitionedRegion().getColocatedWithRegion() != null) { bucketRegion.getPartitionedRegion().getColocatedWithRegion().getRegionAdvisor()
throw new IllegalStateException("Colocated regions should have accessors at the same node"); if (!pr.isShadowPR()) { if (pr.getAttributes().getDataPolicy().withPersistence()) { if (!colocatedPR.getDataPolicy().withPersistence()) {
private void setEventSeqNum() { if (this.partitionedRegion.isShadowPR() && this.partitionedRegion.getColocatedWith() != null) { PartitionedRegion parentPR = ColocationHelper.getLeaderRegion(this.partitionedRegion); BucketRegion parentBucket = parentPR.getDataStore().getLocalBucketById(getId()); // needs to be set only once. if (parentBucket.eventSeqNum == null) { parentBucket.eventSeqNum = new AtomicLong5(getId()); } } if (this.partitionedRegion.getColocatedWith() == null) { this.eventSeqNum = new AtomicLong5(getId()); } else { PartitionedRegion parentPR = ColocationHelper.getLeaderRegion(this.partitionedRegion); BucketRegion parentBucket = parentPR.getDataStore().getLocalBucketById(getId()); if (parentBucket == null && logger.isDebugEnabled()) { logger.debug("The parentBucket of region {} bucketId {} is NULL", this.partitionedRegion.getFullPath(), getId()); } Assert.assertTrue(parentBucket != null); this.eventSeqNum = parentBucket.eventSeqNum; } }
getDistributionManager().getDistributionManagerId(), true, true, false, null, true); } else { if (this.partitionedRegion.isShadowPR() && this.partitionedRegion.getColocatedWith() != null) { PartitionedRegion colocatedRegion =
buk.getBucketAdvisor().setShadowBucketDestroyed(false); if (getPartitionedRegion().isShadowPR()) { getPartitionedRegion().getColocatedWithRegion().getRegionAdvisor() .getBucketAdvisor(possiblyFreeBucketId).setShadowBucketDestroyed(false);
final PartitionedRegion pr = internalRegionArgs.getPartitionedRegion(); internalRegionArgs.setUserAttribute(pr.getUserAttribute()); if (pr.isShadowPR()) { newRegion = new BucketRegionQueue(subregionName, regionAttributes, this, this.cache, internalRegionArgs);