public InternalCache create(InternalDistributedSystem internalDistributedSystem)
      throws TimeoutException, CacheWriterException, GatewayException, RegionExistsException {
    requireNonNull(internalDistributedSystem, "internalDistributedSystem");
    try {
      synchronized (InternalCacheBuilder.class) {
        synchronized (GemFireCacheImpl.class) {
          InternalCache cache =
              existingCache(internalDistributedSystem::getCache, singletonCacheSupplier);
          if (cache == null) {
            cache =
                internalCacheConstructor.construct(isClient, poolFactory, internalDistributedSystem,
                    cacheConfig, useAsyncEventListeners, typeRegistry);

            internalDistributedSystem.setCache(cache);
            cache.initialize();
          } else {
            internalDistributedSystem.setCache(cache);
          }

          return cache;
        }
      }
    } catch (CacheXmlException | IllegalArgumentException e) {
      logger.error(e.getLocalizedMessage());
      throw e;
    } catch (Error | RuntimeException e) {
      logger.error(e);
      throw e;
    }
  }
@see CacheFactory#create(DistributedSystem)

@throws IllegalArgumentException If {@code system} is not {@link DistributedSystem#isConnected
        connected}.
@throws CacheExistsException If an open cache already exists.
@throws CacheXmlException If a problem occurs while parsing the declarative caching XML file.
@throws TimeoutException If a {@link Region#put(Object, Object)} times out while initializing
        the cache.
@throws CacheWriterException If a {@code CacheWriterException} is thrown while initializing the
        cache.
@throws GatewayException If a {@code GatewayException} is thrown while initializing the cache.
@throws RegionExistsException If the declarative caching XML file describes a region that
        already exists (including the root region).
geode-core/src/main/java/org/apache/geode/internal/cache/InternalCacheBuilder.java