private boolean validateExistingCache(InternalCache existingCache) {
    if (existingCache == null || existingCache.isClosed()) {
      return false;
    }

    if (isExistingOk) {
      cacheConfig.validateCacheConfig(existingCache);
    } else {
      existingCache.throwCacheExistsException();
    }

    return true;
  }
Validates that isExistingOk is true and existing cache is compatible with cacheConfig.

if instance exists and cacheConfig is incompatible
if instance exists and isExistingOk is false
geode-core/src/main/java/org/apache/geode/internal/cache/InternalCacheBuilder.java