mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALFCOM-2977 - Dictionary fails to re-init
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14784 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -116,6 +116,7 @@ public class DictionaryBootstrap implements DictionaryListener
|
||||
*/
|
||||
public void register()
|
||||
{
|
||||
dictionaryDAO.destroy(); // deployer - force reload on next get
|
||||
dictionaryDAO.register(this);
|
||||
}
|
||||
|
||||
|
@@ -160,11 +160,11 @@ public interface DictionaryDAO extends ModelQuery
|
||||
|
||||
/**
|
||||
*
|
||||
* Register with the Dictionary
|
||||
* Register listener with the Dictionary
|
||||
*
|
||||
* @param dictionaryDeployer
|
||||
* @param dictionaryListener
|
||||
*/
|
||||
public void register(DictionaryListener dictionaryDeployer);
|
||||
public void register(DictionaryListener dictionaryListener);
|
||||
|
||||
/**
|
||||
* Reset the Dictionary - destroy & re-initialise
|
||||
|
@@ -40,6 +40,7 @@ import org.alfresco.repo.cache.SimpleCache;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||
import org.alfresco.repo.tenant.TenantService;
|
||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||
import org.alfresco.service.cmr.dictionary.AspectDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.AssociationDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.ClassDefinition;
|
||||
@@ -118,12 +119,11 @@ public class DictionaryDAOImpl implements DictionaryDAO
|
||||
/**
|
||||
* Register with the Dictionary
|
||||
*/
|
||||
public void register(DictionaryListener dictionaryDeployer)
|
||||
public void register(DictionaryListener dictionaryListener)
|
||||
{
|
||||
if (! dictionaryListeners.contains(dictionaryDeployer))
|
||||
if (! dictionaryListeners.contains(dictionaryListener))
|
||||
{
|
||||
destroy(); // force reload on next get
|
||||
dictionaryListeners.add(dictionaryDeployer);
|
||||
dictionaryListeners.add(dictionaryListener);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -937,12 +937,19 @@ public class DictionaryDAOImpl implements DictionaryDAO
|
||||
{
|
||||
DictionaryRegistry dictionaryRegistry = null;
|
||||
|
||||
// check threadlocal first - return if set
|
||||
dictionaryRegistry = getDictionaryRegistryLocal(tenantDomain);
|
||||
if (dictionaryRegistry != null)
|
||||
{
|
||||
return dictionaryRegistry; // return local dictionaryRegistry
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// check cache first - return if set
|
||||
// check cache second - return if set
|
||||
readLock.lock();
|
||||
dictionaryRegistry = dictionaryRegistryCache.get(tenantDomain);
|
||||
|
||||
|
||||
if (dictionaryRegistry != null)
|
||||
{
|
||||
return dictionaryRegistry; // return cached config
|
||||
@@ -953,11 +960,9 @@ public class DictionaryDAOImpl implements DictionaryDAO
|
||||
readLock.unlock();
|
||||
}
|
||||
|
||||
// check threadlocal second - return if set
|
||||
dictionaryRegistry = getDictionaryRegistryLocal(tenantDomain);
|
||||
if (dictionaryRegistry != null)
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
return dictionaryRegistry; // return local dictionaryRegistry
|
||||
logger.debug("getDictionaryRegistry: not in cache (or threadlocal) - re-init ["+Thread.currentThread().getId()+", "+AlfrescoTransactionSupport.getTransactionId()+"]"+(tenantDomain.equals(TenantService.DEFAULT_DOMAIN) ? "" : " (Tenant: "+tenantDomain+")"));
|
||||
}
|
||||
|
||||
// reset caches - may have been invalidated (e.g. in a cluster)
|
||||
|
@@ -26,10 +26,9 @@ package org.alfresco.repo.dictionary;
|
||||
|
||||
|
||||
/**
|
||||
* Dictionary Deployer interface.
|
||||
* Dictionary Listener interface.
|
||||
* <p>
|
||||
* This interface allows DictionaryDAO to be (re-)initialised.
|
||||
* Dictionary Deployer components must register with the DictionaryService.
|
||||
* This interface allows Dictionary Listeners to register with the DictionaryService.
|
||||
*
|
||||
*/
|
||||
public interface DictionaryListener
|
||||
|
@@ -436,6 +436,8 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
|
||||
*/
|
||||
public void register()
|
||||
{
|
||||
dictionaryDAO.destroy(); // deployer - force reload on next get
|
||||
|
||||
// register with Dictionary Service to allow (re-)init
|
||||
dictionaryDAO.register(this);
|
||||
|
||||
|
@@ -396,9 +396,17 @@ public class NamespaceDAOImpl implements NamespaceDAO
|
||||
private NamespaceRegistry getNamespaceRegistry(String tenantDomain)
|
||||
{
|
||||
NamespaceRegistry namespaceRegistry = null;
|
||||
|
||||
// check threadlocal first - return if set
|
||||
namespaceRegistry = getNamespaceRegistryLocal(tenantDomain);
|
||||
if (namespaceRegistry != null)
|
||||
{
|
||||
return namespaceRegistry; // return local namespaceRegistry
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// check cache first - return if set
|
||||
// check cache second - return if set
|
||||
readLock.lock();
|
||||
namespaceRegistry = namespaceRegistryCache.get(tenantDomain);
|
||||
|
||||
@@ -412,13 +420,6 @@ public class NamespaceDAOImpl implements NamespaceDAO
|
||||
readLock.unlock();
|
||||
}
|
||||
|
||||
// check threadlocal second - return if set
|
||||
namespaceRegistry = getNamespaceRegistryLocal(tenantDomain);
|
||||
if (namespaceRegistry != null)
|
||||
{
|
||||
return namespaceRegistry; // return local namespaceRegistry
|
||||
}
|
||||
|
||||
// reset caches - may have been invalidated (e.g. in a cluster)
|
||||
namespaceRegistry = reset(tenantDomain);
|
||||
|
||||
|
Reference in New Issue
Block a user