private static boolean remoteCloseCache() throws CacheException {
    Assert.assertTrue(cache != null, "No cache on this VM?");
    Assert.assertTrue(!cache.isClosed(), "Who closed my cache?");

    InternalDistributedSystem system = (InternalDistributedSystem) cache.getDistributedSystem();
    ClusterDistributionManager dm = (ClusterDistributionManager) system.getDistributionManager();
    boolean exceptionInThreads = dm.exceptionInThreads();
    dm.clearExceptionInThreads();

    cache.close();
    cache = null;

    return exceptionInThreads;
  }
Closes the Cache for the current VM. Returns whether or not an exception occurred in the
distribution manager to which this VM is attached. Note that the exception flag is cleared by
this method.

@see ClusterDistributionManager#exceptionInThreads()
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/DistributedCacheTestCase.java