diff --git a/config/alfresco/bootstrap-context.xml b/config/alfresco/bootstrap-context.xml
index ab11034e75..28c52c5791 100644
--- a/config/alfresco/bootstrap-context.xml
+++ b/config/alfresco/bootstrap-context.xml
@@ -147,11 +147,6 @@
-
-
-
-
-
@@ -277,7 +272,12 @@
-
+
+
+
+
+
+
diff --git a/config/alfresco/cache-context.xml b/config/alfresco/cache-context.xml
index 6218260b5d..4d72df3e65 100644
--- a/config/alfresco/cache-context.xml
+++ b/config/alfresco/cache-context.xml
@@ -636,39 +636,7 @@
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.uriToModelsCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.uriToModelsTransactionalCache
-
-
- 100
-
-
-
-
+
@@ -683,7 +651,7 @@
-
+
@@ -700,40 +668,8 @@
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.urisCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.urisTransactionalCache
-
-
- 100
-
-
-
-
-
+
+
@@ -747,7 +683,7 @@
-
+
diff --git a/config/alfresco/core-services-context.xml b/config/alfresco/core-services-context.xml
index 3c0449d925..d16fe3cf04 100644
--- a/config/alfresco/core-services-context.xml
+++ b/config/alfresco/core-services-context.xml
@@ -863,7 +863,7 @@
-
+
@@ -889,11 +889,8 @@
-
-
-
-
+
diff --git a/config/alfresco/ehcache-default.xml b/config/alfresco/ehcache-default.xml
index a5b4647338..2f3dfa53af 100644
--- a/config/alfresco/ehcache-default.xml
+++ b/config/alfresco/ehcache-default.xml
@@ -380,13 +380,6 @@
-
-
-
-
-
-
-
-
-
+
-
+
-
-
+
+
dictionaryRegistryCache;
- // Map of Namespace URI usages to Models
- private SimpleCache>> uriToModelsCache;
-
- // Map of model name to compiled model
- private SimpleCache> compiledModelsCache;
+ // used to reset the cache
+ private ThreadLocal dictionaryRegistryThreadLocal = new ThreadLocal();
+ private ThreadLocal defaultDictionaryRegistryThreadLocal = new ThreadLocal();
// Static list of registered dictionary listeners
private List dictionaryListeners = new ArrayList();
@@ -104,14 +98,9 @@ public class DictionaryDAOImpl implements DictionaryDAO
this.tenantService = tenantService;
}
- public void setUriToModelsCache(SimpleCache>> uriToModelsCache)
+ public void setDictionaryRegistryCache(SimpleCache dictionaryRegistryCache)
{
- this.uriToModelsCache = uriToModelsCache;
- }
-
- public void setCompiledModelsCache(SimpleCache> compiledModelsCache)
- {
- this.compiledModelsCache = compiledModelsCache;
+ this.dictionaryRegistryCache = dictionaryRegistryCache;
}
/**
@@ -133,6 +122,7 @@ public class DictionaryDAOImpl implements DictionaryDAO
{
if (! dictionaryListeners.contains(dictionaryDeployer))
{
+ destroy(); // force reload on next get
dictionaryListeners.add(dictionaryDeployer);
}
}
@@ -142,27 +132,7 @@ public class DictionaryDAOImpl implements DictionaryDAO
*/
public void init()
{
- String tenantDomain = tenantService.getCurrentUserDomain();
-
- // initialise empty dictionary & namespaces
- putCompiledModels(tenantDomain, new HashMap());
- putUriToModels(tenantDomain, new HashMap>());
-
- namespaceDAO.init();
-
- // populate the dictionary
- for (DictionaryListener dictionaryListener : dictionaryListeners)
- {
- dictionaryListener.onDictionaryInit();
- }
-
- // notify registered listeners that dictionary has been initialised
- for (DictionaryListener dictionaryListener : dictionaryListeners)
- {
- dictionaryListener.afterDictionaryInit();
- }
-
- logger.info("Dictionary initialised");
+ initDictionary(tenantService.getCurrentUserDomain());
}
/**
@@ -172,8 +142,7 @@ public class DictionaryDAOImpl implements DictionaryDAO
{
String tenantDomain = tenantService.getCurrentUserDomain();
- removeCompiledModels(tenantDomain);
- removeUriToModels(tenantDomain);
+ removeDictionaryRegistry(tenantDomain);
namespaceDAO.destroy();
@@ -183,7 +152,10 @@ public class DictionaryDAOImpl implements DictionaryDAO
dictionaryDeployer.afterDictionaryDestroy();
}
- logger.info("Dictionary destroyed");
+ if (logger.isDebugEnabled())
+ {
+ logger.debug("Dictionary destroyed");
+ }
}
/**
@@ -191,31 +163,104 @@ public class DictionaryDAOImpl implements DictionaryDAO
*/
public void reset()
{
- reset(tenantService.getCurrentUserDomain());
+ if (logger.isDebugEnabled())
+ {
+ logger.debug("Resetting dictionary ...");
+ }
+
+ destroy();
+ init();
+
+ if (logger.isDebugEnabled())
+ {
+ logger.debug("... resetting dictionary completed");
+ }
}
- private void reset(String tenantDomain)
+ // load dictionary (models and namespaces)
+ private DictionaryRegistry initDictionary(final String tenantDomain)
{
- if (logger.isDebugEnabled())
- {
- logger.debug("Resetting dictionary ...");
- }
+ long startTime = System.currentTimeMillis();
- AuthenticationUtil.runAs(new RunAsWork