More for AR-460: System concurrency

There might be a few SDK projects that still use TransactionUtil, but this checkin gets rid of
its use otherwise.
I took a glance over the areas of the code that use UserTransaction directly and didn't see any
transactionally wrapped code that desperately needed to be put into a retry loop (i.e. write
transactions in a concurrent scenario).  If you spot any that you think might qualify, let me know.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6220 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-07-12 04:15:28 +00:00
parent 32054c773c
commit 0d1bd57217
31 changed files with 230 additions and 286 deletions

View File

@@ -43,7 +43,7 @@ import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.repo.security.authority.AuthorityDAO;
import org.alfresco.repo.transaction.TransactionUtil;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.avmsync.AVMDifference;
@@ -281,13 +281,14 @@ public class WorkflowInterpreter extends AbstractLifecycleBean
{
public String doWork() throws Exception
{
return TransactionUtil.executeInUserTransaction(transactionService, new TransactionUtil.TransactionWork<String>()
RetryingTransactionCallback<String> txnWork = new RetryingTransactionCallback<String>()
{
public String doWork() throws Exception
public String execute() throws Exception
{
return executeCommand(line);
}
});
};
return transactionService.getRetryingTransactionHelper().doInTransaction(txnWork);
}
}, username);
}

View File

@@ -24,7 +24,7 @@
*/
package org.alfresco.repo.workflow.jbpm;
import org.alfresco.repo.transaction.TransactionUtil;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.jbpm.JbpmConfiguration;
import org.jbpm.job.Job;
import org.jbpm.job.executor.JobExecutorThread;
@@ -41,14 +41,6 @@ public class AlfrescoJobExecutorThread extends JobExecutorThread
/**
* Constructor
*
* @param name
* @param jobExecutor
* @param jbpmConfiguration
* @param idleInterval
* @param maxIdleInterval
* @param maxLockTime
* @param maxHistory
*/
public AlfrescoJobExecutorThread(String name, AlfrescoJobExecutor jobExecutor, JbpmConfiguration jbpmConfiguration, int idleInterval, int maxIdleInterval, long maxLockTime, int maxHistory)
{
@@ -56,13 +48,13 @@ public class AlfrescoJobExecutorThread extends JobExecutorThread
this.alfrescoJobExecutor = jobExecutor;
}
/* (non-Javadoc)
* @see org.jbpm.job.executor.JobExecutorThread#executeJob(org.jbpm.job.Job)
/**
* {@inheritDoc}
*/
@Override
protected void executeJob(Job job)
{
TransactionUtil.executeInUserTransaction(alfrescoJobExecutor.getTransactionService(), new TransactionJob(job));
alfrescoJobExecutor.getTransactionService().getRetryingTransactionHelper().doInTransaction(new TransactionJob(job));
}
/**
@@ -70,24 +62,24 @@ public class AlfrescoJobExecutorThread extends JobExecutorThread
*
* @author davidc
*/
private class TransactionJob implements TransactionUtil.TransactionWork<Object>
private class TransactionJob implements RetryingTransactionCallback<Object>
{
private Job job;
/**
* Constructor
*
* @param job
* @param job the job to execute
*/
public TransactionJob(Job job)
{
this.job = job;
}
/* (non-Javadoc)
* @see org.alfresco.repo.transaction.TransactionUtil.TransactionWork#doWork()
/**
* {@inheritDoc}
*/
public Object doWork() throws Throwable
public Object execute() throws Throwable
{
AlfrescoJobExecutorThread.super.executeJob(job);
return null;