private void createPartitionedRegion(final int redundancy, final int recoveryDelay,
      final int numBuckets, final boolean synchronous) throws InterruptedException {
    CountDownLatch recoveryDone = new CountDownLatch(1);

    if (redundancy > 0) {
      ResourceObserver observer = new ResourceObserverAdapter() {
        @Override
        public void recoveryFinished(Region region) {
          recoveryDone.countDown();
        }
      };

      InternalResourceManager.setResourceObserver(observer);
    } else {
      recoveryDone.countDown();
    }

    PartitionAttributesFactory<?, ?> partitionAttributesFactory = new PartitionAttributesFactory();
    partitionAttributesFactory.setRedundantCopies(redundancy);
    partitionAttributesFactory.setRecoveryDelay(recoveryDelay);
    partitionAttributesFactory.setTotalNumBuckets(numBuckets);
    partitionAttributesFactory.setLocalMaxMemory(500);

    RegionFactory<?, ?> regionFactory = getCache().createRegionFactory(PARTITION_PERSISTENT);
    regionFactory.setDiskSynchronous(synchronous);
    regionFactory.setPartitionAttributes(partitionAttributesFactory.create());

    regionFactory.create(partitionedRegionName);

    recoveryDone.await(TIMEOUT_MILLIS, MILLISECONDS);
  }
RegressionTest for bug 42226. <br>
1. Member A has the bucket <br>
2. Member B starts creating the bucket. It tells member A that it hosts the bucket <br>
3. Member A crashes <br>
4. Member B destroys the bucket and throws a partition offline exception, because it wasn't
able to complete initialization. <br>
5. Member A recovers, and gets stuck waiting for member B.

<p>
TRAC 42226: recycled VM hangs during re-start while waiting for Partition to come online (after
Controller VM sees unexpected PartitionOffLineException while doing ops)
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/partitioned/PersistentPartitionHangsDuringRestartRegressionTest.java