From f7e3dc7e6cd8952ac57aa9c58a597455400c28a7 Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Sat, 8 Aug 2015 08:01:06 +0000 Subject: [PATCH] Merged 5.0.N (5.0.3) to HEAD (5.1) 109729: Merged 5.0.2 (5.0.2) to 5.0.N (5.0.3) 109705: MNT-14463: Deadlock during startup DictionaryDAO: Remove side-effect code in: - DictionaryRepositoryBootstrap.register: Now it only registers listeners rathern than destroying and rebuilding the dictionary - DictionaryDAOImpl.removeDictionaryRegistry: Now it only removes the dictionary rather than removes and reinitialized DictionaryRepositoryBootstrap.onBootstrap: - RESETS the dictionary (destroy, reinitialize) - Then registers listeners - Then fires application events The stacks and logs for the deadlock show that the dictioanary bootstrap was triggering a background reload and then firing the application events without checking that the dictionary had loaded. The events will now only be fired once the dictionary has successfully retrieved an instance i.e. no other code will need to wait for the background thread after the reset has finished. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@109804 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../dictionary/DictionaryRepositoryBootstrap.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source/java/org/alfresco/repo/dictionary/DictionaryRepositoryBootstrap.java b/source/java/org/alfresco/repo/dictionary/DictionaryRepositoryBootstrap.java index 94d113ded8..6f13c1491a 100644 --- a/source/java/org/alfresco/repo/dictionary/DictionaryRepositoryBootstrap.java +++ b/source/java/org/alfresco/repo/dictionary/DictionaryRepositoryBootstrap.java @@ -624,7 +624,13 @@ implements TenantDeployer, DictionaryListener, /*TenantDictionaryListener, */Mes @Override protected void onBootstrap(ApplicationEvent event) { + // Reset the dictionary (destroy and reload) + dictionaryDAO.reset(); + + // Register listeners register(); + + // The listeners can now know about this ((ApplicationContext) event.getSource()).publishEvent(new DictionaryRepositoryBootstrappedEvent(this)); } @@ -645,13 +651,10 @@ implements TenantDeployer, DictionaryListener, /*TenantDictionaryListener, */Mes } /** - * Register + * Register listeners */ public void register() { - // deployer - force reload on next get (eg. bootstrap "rmc:rmcustom") - dictionaryDAO.destroy(); - // register with Dictionary Service to allow (re-)init dictionaryDAO.registerListener(this);