private void changeFromPrimaryTo(byte requestedState) { try { this.primaryState = requestedState; } finally { getPartitionedRegionStats().incPrimaryBucketCount(-1); } }
/** * Return (and possibly choose) a thread-sticky member from whose data store this bucket's values * should be read * * @return member to use for reads, null if none available */ public InternalDistributedMember getPreferredNode() { if (isHosting()) { getPartitionedRegionStats().incPreferredReadLocal(); return getDistributionManager().getId(); } Profile locProfiles[] = this.profiles; // volatile read if (locProfiles.length == 0) { return null; } getPartitionedRegionStats().incPreferredReadRemote(); if (locProfiles.length == 1) { // only one choice! return locProfiles[0].peerMemberId; } // Pick one at random. int i = myRand.nextInt(locProfiles.length); return locProfiles[i].peerMemberId; }
@Override public void run() { getPartitionedRegionStats().incVolunteeringThreads(1); boolean releaseSemaphore = true; try { getPartitionedRegionStats().incVolunteeringThreads(-1); if (releaseSemaphore) {
initializationGate(); long startTime = getPartitionedRegionStats().startPrimaryTransfer(isRebalance); try { long waitTime = 2000; // time each iteration will wait getPartitionedRegionStats().endPrimaryTransfer(startTime, isPrimary(), isRebalance);
case VOLUNTEERING_HOSTING: this.primaryState = requestedState; { PartitionedRegionStats stats = getPartitionedRegionStats(); stats.putStartTime(this, stats.startVolunteering()); case BECOMING_HOSTING: this.primaryState = requestedState; { PartitionedRegionStats stats = getPartitionedRegionStats(); stats.putStartTime(this, stats.startVolunteering()); case BECOMING_HOSTING: this.primaryState = requestedState; { PartitionedRegionStats stats = getPartitionedRegionStats(); stats.putStartTime(this, stats.startVolunteering()); PartitionedRegionStats stats = getPartitionedRegionStats(); stats.endVolunteeringClosed(stats.removeStartTime(this)); PartitionedRegionStats stats = getPartitionedRegionStats(); stats.endVolunteeringClosed(stats.removeStartTime(this)); case IS_PRIMARY_HOSTING: this.primaryState = requestedState; { PartitionedRegionStats stats = getPartitionedRegionStats(); stats.incPrimaryBucketCount(1); stats.endVolunteeringBecamePrimary(stats.removeStartTime(this)); case OTHER_PRIMARY_HOSTING: this.primaryState = requestedState; {