mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
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:
@@ -31,7 +31,7 @@ import javax.transaction.UserTransaction;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.alfresco.util.ApplicationContextHelper;
|
||||
@@ -224,9 +224,9 @@ public class AlfrescoTransactionSupportTest extends TestCase
|
||||
}
|
||||
};
|
||||
// start a transaction
|
||||
TransactionWork<Object> bindWork = new TransactionWork<Object>()
|
||||
RetryingTransactionCallback<Object> bindWork = new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
// just bind the listener to the transaction
|
||||
AlfrescoTransactionSupport.bindListener(dummyListener);
|
||||
@@ -235,7 +235,7 @@ public class AlfrescoTransactionSupportTest extends TestCase
|
||||
}
|
||||
};
|
||||
// kick it all off
|
||||
TransactionUtil.executeInNonPropagatingUserTransaction(transactionService, bindWork);
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(bindWork);
|
||||
|
||||
// make sure that the binding all worked
|
||||
assertTrue("Expected callbacks not all processed: " + testList, testList.size() == 0);
|
||||
|
@@ -30,7 +30,7 @@ import javax.transaction.UserTransaction;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.alfresco.util.ApplicationContextHelper;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
@@ -212,22 +212,15 @@ public class TransactionAwareSingletonTest extends TestCase
|
||||
|
||||
private void check(final Integer expected, boolean inTransaction)
|
||||
{
|
||||
TransactionWork<Object> checkWork = new TransactionWork<Object>()
|
||||
RetryingTransactionCallback<Object> checkWork = new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
Integer actual = singleton.get();
|
||||
assertTrue("Values don't match: " + expected + " != " + actual, actual == expected);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
if (inTransaction)
|
||||
{
|
||||
TransactionUtil.executeInUserTransaction(transactionService, checkWork);
|
||||
}
|
||||
else
|
||||
{
|
||||
TransactionUtil.executeInNonPropagatingUserTransaction(transactionService, checkWork);
|
||||
}
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(checkWork, false, !inTransaction);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user