private void changeFromPrimaryTo(byte requestedState) {
    try {
      primaryState = requestedState;
      hasBecomePrimary = false;
    } finally {
      getPartitionedRegionStats().incPrimaryBucketCount(-1);
    }
  }
Requests change to the requested primary state. Controls all state changes pertaining to
primary state. Caller must be synchronized on this.

@param requestedState primaryState to change to
@return true if the requestedState change was completed
@throws IllegalStateException if an illegal state change was attempted
geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java