@Test
  public void getNumSubscriptionsDeadlocksOnCacheFactory() throws Exception {
    givenCacheFactoryIsSynchronized();
    givenCacheServerBridge();

    blocking.execute(() -> {
      try {
        before.set(true);

        // getNumSubscriptions -> getClientQueueSizes -> synchronizes on CacheFactory
        cacheServerBridge.getNumSubscriptions();

      } finally {
        after.set(true);
      }
    });

    await().until(before::get);

    // if deadlocked, then this line will throw ConditionTimeoutException
    await().untilAsserted(() -> assertThat(after.get()).isTrue());
  }
JMX and membership should not deadlock on CacheFactory.getAnyInstance.

<p>
GEODE-3407: JMX and membership may deadlock on CacheFactory.getAnyInstance
geode-core/src/test/java/org/apache/geode/management/internal/beans/CacheServerBridgeClientMembershipRegressionTest.java