ALF-1946: Cut down repository startup time by only refreshing web script registry once!

- A discovery by Kev
- RepositoryContainer now remembers whether or not it is initialized and doesn't refresh a registry returned by getRegistry() when it is not (as the superclass will think it has to initialize it)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19217 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2010-03-11 11:42:02 +00:00
parent f79c5c64d4
commit 647930c0a4

View File

@@ -91,6 +91,7 @@ public class RepositoryContainer extends AbstractRuntimeContainer implements Ten
private TenantAdminService tenantAdminService;
private ObjectFactory registryFactory;
private SimpleCache<String, Registry> webScriptsRegistryCache;
private boolean initialized;
/**
* @param webScriptsRegistryCache
@@ -457,7 +458,11 @@ public class RepositoryContainer extends AbstractRuntimeContainer implements Ten
if (registry == null)
{
registry = (Registry)registryFactory.getObject();
registry.reset();
// We only need to reset the registry if the superclass thinks its already initialized
if (initialized)
{
registry.reset();
}
webScriptsRegistryCache.put(tenantDomain, registry);
}
return registry;
@@ -552,6 +557,8 @@ public class RepositoryContainer extends AbstractRuntimeContainer implements Ten
tenantAdminService.register(this);
super.reset();
initialized = true;
}
/* (non-Javadoc)
@@ -560,6 +567,8 @@ public class RepositoryContainer extends AbstractRuntimeContainer implements Ten
public void destroy()
{
webScriptsRegistryCache.remove(tenantAdminService.getCurrentUserDomain());
initialized = false;
}