Skip to content

Commit

Permalink
Fixed: #3665 - Unable to Access the Instance
Browse files Browse the repository at this point in the history
  • Loading branch information
delchev committed Mar 30, 2024
1 parent 3aca479 commit c0491bc
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;

/**
* A factory for creating CmsProviderInternal objects.
Expand All @@ -38,6 +40,9 @@ class CmsProviderInternalFactory implements CmsProviderFactory {
/** The default tenant. */
private final Tenant defaultTenant;

/** The Constant PROVIDERS. */
private static final Map<String, CmsProvider> PROVIDERS = new HashMap<String, CmsProvider>();

/**
* Instantiates a new cms provider internal factory.
*
Expand All @@ -59,8 +64,12 @@ public CmsProvider create() {
String rootFolder = DirigibleConfig.CMS_INTERNAL_ROOT_FOLDER.getStringValue() + getTenantFolder();
Path path = Paths.get(rootFolder);
boolean absolutePath = path.isAbsolute();

return new CmsProviderInternal(rootFolder, absolutePath);
if (PROVIDERS.containsKey(rootFolder)) {
return PROVIDERS.get(rootFolder);
}
CmsProviderInternal cmsProviderInternal = new CmsProviderInternal(rootFolder, absolutePath);
PROVIDERS.put(rootFolder, cmsProviderInternal);
return cmsProviderInternal;
}

/**
Expand Down

0 comments on commit c0491bc

Please sign in to comment.