private void waitForCreate(VM vm0, final String regionName, final int expirationTime) {
    vm0.invoke(new SerializableRunnable() {
      @Override
      public void run() {
        RegionFactory<Object, Object> rf = getCache().createRegionFactory(RegionShortcut.PARTITION)
            // .setEvictionAttributes(EvictionAttributes.createLIFOEntryAttributes(evictionEntries,
            // EvictionAction.LOCAL_DESTROY))
            .setEntryTimeToLive(new ExpirationAttributes(expirationTime));

        // We may log an exception if the create fails. Ignore thse.
        IgnoredException ex = IgnoredException.addIgnoredException("IllegalStateException");
        try {
          int i = 0;
          // Loop until a successful create
          while (true) {
            try {
              i++;
              rf.create(regionName);
              // if the create was succesfull, we're done
              return;
            } catch (IllegalStateException expected) {
              // give up if we can't create the region in 20 tries
              if (i == 20) {
                Assert.fail("Metadata was never cleaned up in 20 tries", expected);
              }

              // wait a bit before the next attempt.
              Wait.pause(500);
            }
          }
        } finally {
          ex.remove();
        }
      }
    });
  }
Try to create the region with the given attributes. This will try 20 times to create the region
until the region can be successfully created without an illegal state exception.

This is a workaround for bug 47125, because the metadata cleanup happens asynchronously.
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionMetaDataCleanupDUnitTest.java