From 6a58dd6b97d4b938d195cc7be9bd9b39c911c270 Mon Sep 17 00:00:00 2001 From: Jan Vonka Date: Fri, 19 Dec 2008 17:44:01 +0000 Subject: [PATCH] Merged V3.0 to HEAD 12185: Fix 3.0 SP1 installation on non-Oracle databases. Removed creation of indexes in AlfrescoPostCreate-2.2-MappedFKIndexes.sql that were also in AlfrescoPostCreate-2.2-Extra.sql 12186: Performance improvements to HibernateNodeDaoServiceImpl 12188: Multi user tests: enable graceful web script recovery on optimistic locking failure (...) 12191: Improve Javascript execution performance in Web Scripts & Improve error presentation (...) thrown by JavaScript 12192: Share performance improvements: stop AbstractFeedGenerator from 'choking' the repository with too many web script requests 12193: Multi user testing: don't suppress all exceptions during Wiki Move. 12194: Multi user testing. Don't suppress all runtime exceptions in script site node object. 12195: Multi user testing. Convert User bean object to use a retrying transaction so that optimistic locking failures are handled. 12196: Multi user testing: Configuration changes to support concurrent access by 20 users git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12522 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../alfresco/slingshot/wiki/move.post.json.js | 45 ++++++++----------- .../alfresco/repo/web/scripts/RepoStore.java | 4 +- .../repo/web/scripts/RepositoryContainer.java | 20 ++++++--- 3 files changed, 36 insertions(+), 33 deletions(-) diff --git a/config/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post.json.js b/config/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post.json.js index df8e0e0b7e..cbc208e0f8 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post.json.js +++ b/config/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/move.post.json.js @@ -42,34 +42,27 @@ function main() } // Finally, now we can do what we are supposed to do - try + var currentName = new String(page.name); + + page.name = newName; + page.properties["cm:title"] = new String(newName).replace(/_/g, " "); + page.save(); + + var placeholder = createWikiPage(currentName, wiki, { - var currentName = new String(page.name); + content: "This page has been moved [[" + newName + "|here]]." + }); - page.name = newName; - page.properties["cm:title"] = new String(newName).replace(/_/g, " "); - page.save(); - - var placeholder = createWikiPage(currentName, wiki, - { - content: "This page has been moved [[" + newName + "|here]]." - }); - - var data = - { - title: newName.replace(/_/g, " "), - page: json.get("page") + "?title=" + newName, - custom0: currentName.replace(/_/g, " ") - } - - activities.postActivity("org.alfresco.wiki.page-renamed", params.siteId, "wiki", jsonUtils.toJSONString(data)); - - return { - name: newName // Return the new name to the client (?) - } + var data = + { + title: newName.replace(/_/g, " "), + page: json.get("page") + "?title=" + newName, + custom0: currentName.replace(/_/g, " ") } - catch (e) - { - return jsonError(e.toString()); + + activities.postActivity("org.alfresco.wiki.page-renamed", params.siteId, "wiki", jsonUtils.toJSONString(data)); + + return { + name: newName // Return the new name to the client (?) } } \ No newline at end of file diff --git a/source/java/org/alfresco/repo/web/scripts/RepoStore.java b/source/java/org/alfresco/repo/web/scripts/RepoStore.java index 2d89053a7c..9b04d0d2a8 100644 --- a/source/java/org/alfresco/repo/web/scripts/RepoStore.java +++ b/source/java/org/alfresco/repo/web/scripts/RepoStore.java @@ -700,6 +700,8 @@ public class RepoStore implements Store, TenantDeployer { public Object doWork() throws Exception { + // Run this in an isolated transaction to avoid flushing an uncommitted webscript transaction and + // causing deadlocks or trying to flush a 'dead' failed transaction return retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() { public Object execute() throws Exception @@ -712,7 +714,7 @@ public class RepoStore implements Store, TenantDeployer } return source; } - }); + }, true, true); } }, AuthenticationUtil.getSystemUserName()); } diff --git a/source/java/org/alfresco/repo/web/scripts/RepositoryContainer.java b/source/java/org/alfresco/repo/web/scripts/RepositoryContainer.java index e0cbd62f97..625bb15f04 100644 --- a/source/java/org/alfresco/repo/web/scripts/RepositoryContainer.java +++ b/source/java/org/alfresco/repo/web/scripts/RepositoryContainer.java @@ -163,16 +163,24 @@ public class RepositoryContainer extends AbstractRuntimeContainer implements Ten return params; } - /* (non-Javadoc) + /* + * (non-Javadoc) * @see org.alfresco.web.scripts.AbstractRuntimeContainer#getTemplateParameters() */ public Map getTemplateParameters() { - Map params = new HashMap(); - params.putAll(super.getTemplateParameters()); - params.put(TemplateService.KEY_IMAGE_RESOLVER, imageResolver.getImageResolver()); - addRepoParameters(params); - return params; + // This must be in an isolated read-only transaction, in case we are handling failure of another transaction + return retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback>() + { + public Map execute() throws Throwable + { + Map params = new HashMap(); + params.putAll(RepositoryContainer.super.getTemplateParameters()); + params.put(TemplateService.KEY_IMAGE_RESOLVER, imageResolver.getImageResolver()); + addRepoParameters(params); + return params; + } + }, true, true); } /**