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,8 +31,7 @@ import java.util.Properties;
|
||||
import org.alfresco.repo.importer.ImporterBootstrap;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
import org.alfresco.repo.security.authentication.MutableAuthenticationDao;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
@@ -72,9 +71,9 @@ public class TestData
|
||||
{
|
||||
final ServiceRegistry serviceRegistry = (ServiceRegistry) applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
|
||||
TransactionService transactionService = serviceRegistry.getTransactionService();
|
||||
TransactionWork<Object> createUserWork = new TransactionWork<Object>()
|
||||
RetryingTransactionCallback<Object> createUserWork = new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
// Bootstrap Users
|
||||
MutableAuthenticationDao authDAO = (MutableAuthenticationDao) applicationContext.getBean("alfDaoImpl");
|
||||
@@ -93,7 +92,7 @@ public class TestData
|
||||
return null;
|
||||
}
|
||||
};
|
||||
TransactionUtil.executeInUserTransaction(transactionService, createUserWork);
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(createUserWork);
|
||||
|
||||
try
|
||||
{
|
||||
|
@@ -42,7 +42,7 @@ import org.alfresco.repo.action.executer.CompositeActionExecuter;
|
||||
import org.alfresco.repo.action.executer.MoveActionExecuter;
|
||||
import org.alfresco.repo.action.executer.ScriptActionExecuter;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ActionCondition;
|
||||
import org.alfresco.service.cmr.action.ActionConditionDefinition;
|
||||
@@ -810,11 +810,10 @@ public class ActionServiceImplTest extends BaseAlfrescoSpringTest
|
||||
// Sleep for a bit
|
||||
Thread.sleep(sleepTime);
|
||||
|
||||
done = (TransactionUtil.executeInUserTransaction(
|
||||
transactionService,
|
||||
new TransactionUtil.TransactionWork<Boolean>()
|
||||
done = (transactionService.getRetryingTransactionHelper().doInTransaction(
|
||||
new RetryingTransactionCallback<Boolean>()
|
||||
{
|
||||
public Boolean doWork()
|
||||
public Boolean execute()
|
||||
{
|
||||
// See if the action has been performed
|
||||
boolean done = test.executeTest();
|
||||
@@ -947,11 +946,10 @@ public class ActionServiceImplTest extends BaseAlfrescoSpringTest
|
||||
// Modify the compensating action so that it will also fail
|
||||
compensatingAction.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, QName.createQName("{test}badAspect"));
|
||||
|
||||
TransactionUtil.executeInUserTransaction(
|
||||
this.transactionService,
|
||||
new TransactionUtil.TransactionWork<Object>()
|
||||
this.transactionService.getRetryingTransactionHelper().doInTransaction(
|
||||
new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork()
|
||||
public Object execute()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@@ -29,7 +29,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ActionService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
@@ -461,10 +461,10 @@ public abstract class AbstractScheduledAction implements ScheduledActionDefiniti
|
||||
|
||||
try
|
||||
{
|
||||
TransactionUtil.executeInUserTransaction(abstractScheduledAction.getTransactionService(),
|
||||
new TransactionUtil.TransactionWork<Object>()
|
||||
abstractScheduledAction.getTransactionService().getRetryingTransactionHelper().doInTransaction(
|
||||
new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
// Build the full list of compensating actions
|
||||
// If anything goes wrong we need to do all these instead
|
||||
@@ -561,10 +561,10 @@ public abstract class AbstractScheduledAction implements ScheduledActionDefiniti
|
||||
|
||||
try
|
||||
{
|
||||
TransactionUtil.executeInUserTransaction(abstractScheduledAction.getTransactionService(),
|
||||
new TransactionUtil.TransactionWork<Object>()
|
||||
abstractScheduledAction.getTransactionService().getRetryingTransactionHelper().doInTransaction(
|
||||
new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
// try action - failure triggers compensation
|
||||
Action action = abstractScheduledAction.getAction(nodeRef);
|
||||
@@ -611,10 +611,10 @@ public abstract class AbstractScheduledAction implements ScheduledActionDefiniti
|
||||
|
||||
try
|
||||
{
|
||||
TransactionUtil.executeInUserTransaction(abstractScheduledAction.getTransactionService(),
|
||||
new TransactionUtil.TransactionWork<Object>()
|
||||
abstractScheduledAction.getTransactionService().getRetryingTransactionHelper().doInTransaction(
|
||||
new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@@ -34,9 +34,7 @@ import org.alfresco.i18n.I18NUtil;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.importer.ImporterBootstrap;
|
||||
import org.alfresco.repo.node.index.FullIndexRecoveryComponent.RecoveryMode;
|
||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.InvalidStoreRefException;
|
||||
@@ -173,15 +171,15 @@ public class ConfigurationChecker extends AbstractLifecycleBean
|
||||
@Override
|
||||
protected void onBootstrap(ApplicationEvent event)
|
||||
{
|
||||
TransactionWork<Object> checkWork = new TransactionWork<Object>()
|
||||
RetryingTransactionCallback<Object> checkWork = new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
check();
|
||||
return null;
|
||||
}
|
||||
};
|
||||
TransactionUtil.executeInUserTransaction(transactionService, checkWork);
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(checkWork);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -216,6 +214,7 @@ public class ConfigurationChecker extends AbstractLifecycleBean
|
||||
// continue;
|
||||
//}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
NodeRef rootNodeRef = null;
|
||||
try
|
||||
{
|
||||
|
@@ -33,8 +33,7 @@ import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.node.integrity.IntegrityChecker;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.admin.PatchException;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
@@ -340,9 +339,9 @@ public abstract class AbstractPatch implements Patch
|
||||
{
|
||||
public String doWork() throws Exception
|
||||
{
|
||||
TransactionWork<String> patchWork = new TransactionWork<String>()
|
||||
RetryingTransactionCallback<String> patchWork = new RetryingTransactionCallback<String>()
|
||||
{
|
||||
public String doWork() throws Exception
|
||||
public String execute() throws Exception
|
||||
{
|
||||
|
||||
// downgrade integrity checking
|
||||
@@ -353,8 +352,7 @@ public abstract class AbstractPatch implements Patch
|
||||
return report;
|
||||
}
|
||||
};
|
||||
|
||||
return TransactionUtil.executeInNonPropagatingUserTransaction(transactionService, patchWork);
|
||||
return transactionService.getRetryingTransactionHelper().doInTransaction(patchWork);
|
||||
}
|
||||
};
|
||||
String report = AuthenticationUtil.runAs(authorisedPathWork, AuthenticationUtil.getSystemUserName());
|
||||
|
@@ -42,8 +42,7 @@ import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.model.WCMAppModel;
|
||||
import org.alfresco.repo.domain.PropertyValue;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.repo.workflow.WorkflowModel;
|
||||
import org.alfresco.sandbox.SandboxConstants;
|
||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||
@@ -170,16 +169,15 @@ public class AVMExpiredContentProcessor
|
||||
{
|
||||
public String doWork() throws Exception
|
||||
{
|
||||
TransactionWork<String> expiredContentWork = new TransactionWork<String>()
|
||||
RetryingTransactionCallback<String> expiredContentWork = new RetryingTransactionCallback<String>()
|
||||
{
|
||||
public String doWork() throws Exception
|
||||
public String execute() throws Exception
|
||||
{
|
||||
processExpiredContent();
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
return TransactionUtil.executeInNonPropagatingUserTransaction(transactionService, expiredContentWork);
|
||||
return transactionService.getRetryingTransactionHelper().doInTransaction(expiredContentWork);
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -56,7 +56,7 @@ import org.alfresco.repo.search.Indexer;
|
||||
import org.alfresco.repo.search.impl.lucene.AVMLuceneIndexer;
|
||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.avm.AVMBadArgumentException;
|
||||
import org.alfresco.service.cmr.avm.AVMCycleException;
|
||||
import org.alfresco.service.cmr.avm.AVMException;
|
||||
@@ -68,11 +68,8 @@ import org.alfresco.service.cmr.avm.LayeringDescriptor;
|
||||
import org.alfresco.service.cmr.avm.VersionDescriptor;
|
||||
import org.alfresco.service.cmr.avm.deploy.DeploymentReport;
|
||||
import org.alfresco.service.cmr.avm.deploy.DeploymentService;
|
||||
import org.alfresco.service.cmr.avm.locking.AVMLockingException;
|
||||
import org.alfresco.service.cmr.avm.locking.AVMLockingService;
|
||||
import org.alfresco.service.cmr.avmsync.AVMDifference;
|
||||
import org.alfresco.service.cmr.avmsync.AVMSyncException;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.model.FileFolderService;
|
||||
import org.alfresco.service.cmr.remote.RepoRemote;
|
||||
import org.alfresco.service.cmr.repository.ContentData;
|
||||
@@ -1081,17 +1078,17 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
action.setParameterValue(AVMRevertToVersionAction.TOREVERT, toRevert);
|
||||
final AVMRevertToVersionAction revert = (AVMRevertToVersionAction) fContext
|
||||
.getBean("avm-revert-to-version");
|
||||
class TxnWork implements TransactionUtil.TransactionWork<Object>
|
||||
class TxnWork implements RetryingTransactionCallback<Object>
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
revert.execute(action, AVMNodeConverter.ToNodeRef(-1, "main:/a/b/c/foo"));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
;
|
||||
TransactionUtil.executeInUserTransaction((TransactionService) fContext.getBean("transactionComponent"),
|
||||
new TxnWork());
|
||||
};
|
||||
TransactionService transactionService = (TransactionService) fContext.getBean("transactionService");
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new TxnWork());
|
||||
|
||||
results = searchService.query(storeRef, "lucene", "TEXT:\"HEAD\"");
|
||||
assertEquals(0, results.length());
|
||||
results.close();
|
||||
@@ -1774,17 +1771,17 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
action.setParameterValue(AVMRevertListAction.PARAM_VERSION, fService.getLatestSnapshotID("area"));
|
||||
action.setParameterValue(AVMRevertListAction.PARAM_NODE_LIST, (Serializable) paths);
|
||||
final AVMRevertListAction revert = (AVMRevertListAction) fContext.getBean("avm-revert-list");
|
||||
class TxnWork implements TransactionUtil.TransactionWork<Object>
|
||||
class TxnWork implements RetryingTransactionCallback<Object>
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
revert.execute(action, null);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
;
|
||||
TransactionUtil.executeInUserTransaction((TransactionService) fContext.getBean("transactionComponent"),
|
||||
new TxnWork());
|
||||
};
|
||||
TransactionService transactionService = (TransactionService) fContext.getBean("transactionService");
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new TxnWork());
|
||||
|
||||
diffs = fSyncService.compare(-1, "area:/a", -1, "main:/a", null);
|
||||
assertEquals(0, diffs.size());
|
||||
System.out.println(recursiveList("area", -1, true));
|
||||
@@ -1819,17 +1816,17 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
versionPaths.add(new Pair<Integer, String>(-1, "area:/a/b/c/bar"));
|
||||
action.setParameterValue(AVMUndoSandboxListAction.PARAM_NODE_LIST, (Serializable) versionPaths);
|
||||
final AVMUndoSandboxListAction revert = (AVMUndoSandboxListAction) fContext.getBean("avm-undo-list");
|
||||
class TxnWork implements TransactionUtil.TransactionWork<Object>
|
||||
class TxnWork implements RetryingTransactionCallback<Object>
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
revert.execute(action, null);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
;
|
||||
TransactionUtil.executeInUserTransaction((TransactionService) fContext.getBean("transactionComponent"),
|
||||
new TxnWork());
|
||||
};
|
||||
TransactionService transactionService = (TransactionService) fContext.getBean("transactionService");
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new TxnWork());
|
||||
|
||||
diffs = fSyncService.compare(-1, "area:/a", -1, "main:/a", null);
|
||||
assertEquals(0, diffs.size());
|
||||
System.out.println(recursiveList("area", -1, true));
|
||||
@@ -1862,18 +1859,18 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
+ JNDIConstants.DIR_DEFAULT_WWW + "/a"), GUID.generate(), SimpleAVMPromoteAction.NAME);
|
||||
action.setParameterValue(SimpleAVMPromoteAction.PARAM_TARGET_STORE, "main");
|
||||
final SimpleAVMPromoteAction promote = (SimpleAVMPromoteAction) fContext.getBean("simple-avm-promote");
|
||||
class TxnWork implements TransactionUtil.TransactionWork<Object>
|
||||
class TxnWork implements RetryingTransactionCallback<Object>
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
promote.execute(action, AVMNodeConverter.ToNodeRef(-1, "source:/"
|
||||
+ JNDIConstants.DIR_DEFAULT_WWW + "/a"));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
;
|
||||
TransactionUtil.executeInUserTransaction((TransactionService) fContext.getBean("transactionComponent"),
|
||||
new TxnWork());
|
||||
};
|
||||
TransactionService transactionService = (TransactionService) fContext.getBean("transactionService");
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new TxnWork());
|
||||
|
||||
assertEquals(0, fSyncService.compare(-1, "source:/" + JNDIConstants.DIR_DEFAULT_WWW, -1,
|
||||
"main:/" + JNDIConstants.DIR_DEFAULT_WWW, null).size());
|
||||
}
|
||||
@@ -1935,18 +1932,17 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
"foo-staging:/" + JNDIConstants.DIR_DEFAULT_WWW, null);
|
||||
assertEquals(3, diffs.size());
|
||||
final SimpleAVMSubmitAction action = (SimpleAVMSubmitAction) fContext.getBean("simple-avm-submit");
|
||||
class TxnWork implements TransactionUtil.TransactionWork<Object>
|
||||
class TxnWork implements RetryingTransactionCallback<Object>
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
action.execute(null, AVMNodeConverter.ToNodeRef(-1, "area:/" + JNDIConstants.DIR_DEFAULT_WWW));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
;
|
||||
TxnWork worker = new TxnWork();
|
||||
TransactionUtil.executeInUserTransaction((TransactionService) fContext.getBean("transactionComponent"),
|
||||
worker);
|
||||
};
|
||||
TransactionService transactionService = (TransactionService) fContext.getBean("transactionService");
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new TxnWork());
|
||||
|
||||
diffs = fSyncService.compare(-1, "area:/" + JNDIConstants.DIR_DEFAULT_WWW, -1, "foo-staging:/"
|
||||
+ JNDIConstants.DIR_DEFAULT_WWW, null);
|
||||
|
||||
@@ -5355,7 +5351,7 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
try
|
||||
{
|
||||
setupBasicTree();
|
||||
class TxnCallback implements RetryingTransactionHelper.RetryingTransactionCallback
|
||||
class TxnCallback implements RetryingTransactionHelper.RetryingTransactionCallback<Object>
|
||||
{
|
||||
public Object execute()
|
||||
{
|
||||
@@ -5412,8 +5408,8 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
}
|
||||
}
|
||||
}
|
||||
RetryingTransactionHelper helper = (RetryingTransactionHelper) fContext
|
||||
.getBean("retryingTransactionHelper");
|
||||
TransactionService transactionService = (TransactionService) fContext.getBean("transactionService");
|
||||
RetryingTransactionHelper helper = transactionService.getRetryingTransactionHelper();
|
||||
helper.doInTransaction(new TxnCallback(), false);
|
||||
assertNotNull(fService.lookup(-1, "main:/layer/b/c/groo"));
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@
|
||||
|
||||
package org.alfresco.repo.avm;
|
||||
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
|
||||
/**
|
||||
@@ -73,16 +73,14 @@ public class Issuer
|
||||
*/
|
||||
public void initialize()
|
||||
{
|
||||
class TxnWork implements TransactionUtil.TransactionWork<Long>
|
||||
class TxnWork implements RetryingTransactionCallback<Long>
|
||||
{
|
||||
public Long doWork() throws Exception
|
||||
public Long execute() throws Exception
|
||||
{
|
||||
return AVMDAOs.Instance().fIssuerDAO.getIssuerValue(fName);
|
||||
}
|
||||
}
|
||||
Long result = TransactionUtil.executeInUserTransaction(fTransactionService,
|
||||
new TxnWork(),
|
||||
true);
|
||||
Long result = fTransactionService.getRetryingTransactionHelper().doInTransaction(new TxnWork(), true);
|
||||
if (result == null)
|
||||
{
|
||||
fNext = 0L;
|
||||
|
@@ -27,7 +27,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.domain.DbAccessControlList;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.hibernate.SessionFactory;
|
||||
@@ -242,9 +242,9 @@ public class OrphanReaper
|
||||
*/
|
||||
public void doBatch()
|
||||
{
|
||||
class TxnWork implements TransactionUtil.TransactionWork<Object>
|
||||
class TxnWork implements RetryingTransactionCallback<Object>
|
||||
{
|
||||
public Object doWork()
|
||||
public Object execute()
|
||||
throws Exception
|
||||
{
|
||||
if (fPurgeQueue == null)
|
||||
@@ -341,8 +341,7 @@ public class OrphanReaper
|
||||
}
|
||||
try
|
||||
{
|
||||
TransactionUtil.executeInUserTransaction(fTransactionService,
|
||||
new TxnWork());
|
||||
fTransactionService.getRetryingTransactionHelper().doInTransaction(new TxnWork());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@@ -26,17 +26,15 @@ package org.alfresco.repo.coci;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.repo.version.VersionModel;
|
||||
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
|
||||
import org.alfresco.service.cmr.lock.LockService;
|
||||
import org.alfresco.service.cmr.repository.AssociationRef;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.ContentData;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
@@ -419,11 +417,10 @@ public class CheckOutCheckInServiceImplTest extends BaseSpringTest
|
||||
|
||||
final NodeRef finalNodeRef = origNodeRef;
|
||||
|
||||
TransactionUtil.executeInUserTransaction(
|
||||
this.transactionService,
|
||||
new TransactionUtil.TransactionWork<Object>()
|
||||
this.transactionService.getRetryingTransactionHelper().doInTransaction(
|
||||
new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork()
|
||||
public Object execute()
|
||||
{
|
||||
NodeRef wk2 = CheckOutCheckInServiceImplTest.this.cociService.getWorkingCopy(finalNodeRef);
|
||||
assertNotNull(wk2);
|
||||
@@ -432,7 +429,6 @@ public class CheckOutCheckInServiceImplTest extends BaseSpringTest
|
||||
CheckOutCheckInServiceImplTest.this.cociService.cancelCheckout(workingCopy);
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
NodeRef wk3 = this.cociService.getWorkingCopy(this.nodeRef);
|
||||
|
@@ -35,8 +35,7 @@ import java.util.Properties;
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.importer.ImporterBootstrap;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
@@ -163,9 +162,9 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
||||
{
|
||||
// initialise the repository descriptor
|
||||
// note: this requires that the repository schema has already been initialised
|
||||
TransactionWork<Descriptor> createDescriptorWork = new TransactionUtil.TransactionWork<Descriptor>()
|
||||
RetryingTransactionCallback<Descriptor> createDescriptorWork = new RetryingTransactionCallback<Descriptor>()
|
||||
{
|
||||
public Descriptor doWork()
|
||||
public Descriptor execute()
|
||||
{
|
||||
// initialise license service (if installed)
|
||||
initialiseLicenseService();
|
||||
@@ -180,7 +179,7 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
|
||||
return createInstalledRepositoryDescriptor();
|
||||
}
|
||||
};
|
||||
installedRepoDescriptor = TransactionUtil.executeInUserTransaction(transactionService, createDescriptorWork);
|
||||
installedRepoDescriptor = transactionService.getRetryingTransactionHelper().doInTransaction(createDescriptorWork);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -26,7 +26,7 @@ package org.alfresco.repo.dictionary;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryException;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
@@ -180,9 +180,9 @@ public class DictionaryModelTypeTest extends BaseAlfrescoSpringTest
|
||||
setComplete();
|
||||
endTransaction();
|
||||
|
||||
final NodeRef workingCopy = TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionUtil.TransactionWork<NodeRef>()
|
||||
final NodeRef workingCopy = transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<NodeRef>()
|
||||
{
|
||||
public NodeRef doWork() throws Exception
|
||||
public NodeRef execute() throws Exception
|
||||
{
|
||||
// Check that the meta data has been extracted from the model
|
||||
assertEquals(QName.createQName("{http://www.alfresco.org/test/testmodel1/1.0}testModelOne"),
|
||||
@@ -210,9 +210,9 @@ public class DictionaryModelTypeTest extends BaseAlfrescoSpringTest
|
||||
}
|
||||
});
|
||||
|
||||
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionUtil.TransactionWork<Object>()
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
// Check that the policy has not been fired since we have updated a working copy
|
||||
assertEquals("1.0", DictionaryModelTypeTest.this.nodeService.getProperty(workingCopy, ContentModel.PROP_MODEL_VERSION));
|
||||
@@ -223,9 +223,9 @@ public class DictionaryModelTypeTest extends BaseAlfrescoSpringTest
|
||||
}
|
||||
});
|
||||
|
||||
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionUtil.TransactionWork<Object>()
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
// Now check that the model has been updated
|
||||
assertEquals("1.1", DictionaryModelTypeTest.this.nodeService.getProperty(modelNode, ContentModel.PROP_MODEL_VERSION));
|
||||
@@ -270,9 +270,9 @@ public class DictionaryModelTypeTest extends BaseAlfrescoSpringTest
|
||||
setComplete();
|
||||
endTransaction();
|
||||
|
||||
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionUtil.TransactionWork<Object>()
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
// The model should not yet be loaded
|
||||
try
|
||||
@@ -293,9 +293,9 @@ public class DictionaryModelTypeTest extends BaseAlfrescoSpringTest
|
||||
}
|
||||
});
|
||||
|
||||
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionUtil.TransactionWork<Object>()
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
// The model should now be loaded
|
||||
assertNotNull(DictionaryModelTypeTest.this.dictionaryService.getModel(TEST_MODEL_ONE));
|
||||
@@ -307,9 +307,9 @@ public class DictionaryModelTypeTest extends BaseAlfrescoSpringTest
|
||||
}
|
||||
});
|
||||
|
||||
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionUtil.TransactionWork<Object>()
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
// The model should not be loaded
|
||||
try
|
||||
@@ -330,9 +330,9 @@ public class DictionaryModelTypeTest extends BaseAlfrescoSpringTest
|
||||
}
|
||||
});
|
||||
|
||||
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionUtil.TransactionWork<Object>()
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
// The model should now be loaded
|
||||
assertNotNull(DictionaryModelTypeTest.this.dictionaryService.getModel(TEST_MODEL_ONE));
|
||||
|
@@ -31,7 +31,7 @@ import java.util.Map;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
@@ -131,9 +131,9 @@ public class DictionaryRepositoryBootstrap
|
||||
@SuppressWarnings("unchecked")
|
||||
public void bootstrap()
|
||||
{
|
||||
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionUtil.TransactionWork()
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
DictionaryRepositoryBootstrap.this.authenticationComponent.setCurrentUser(
|
||||
DictionaryRepositoryBootstrap.this.authenticationComponent.getSystemUserName());
|
||||
|
@@ -35,8 +35,8 @@ import java.util.Map;
|
||||
|
||||
import org.alfresco.model.ApplicationModel;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.ContentData;
|
||||
@@ -170,25 +170,26 @@ public class FileImporterImpl implements FileImporter
|
||||
boolean recurse,
|
||||
final String containerName) throws Throwable
|
||||
{
|
||||
RetryingTransactionHelper txnHelper = transactionService.getRetryingTransactionHelper();
|
||||
if (containerName != null)
|
||||
{
|
||||
TransactionWork<NodeRef> createDirectoryWork = new TransactionWork<NodeRef>()
|
||||
RetryingTransactionCallback<NodeRef> createDirectoryWork = new RetryingTransactionCallback<NodeRef>()
|
||||
{
|
||||
public NodeRef doWork() throws Exception
|
||||
public NodeRef execute() throws Exception
|
||||
{
|
||||
return createDirectory(container, containerName, containerName);
|
||||
}
|
||||
};
|
||||
NodeRef newContainer = TransactionUtil.executeInUserTransaction(transactionService, createDirectoryWork);
|
||||
NodeRef newContainer = txnHelper.doInTransaction(createDirectoryWork);
|
||||
return create(counter, newContainer, file, filter, recurse, null);
|
||||
|
||||
}
|
||||
if (file.isDirectory())
|
||||
{
|
||||
counter.increment();
|
||||
TransactionWork<NodeRef> createDirectoryWork = new TransactionWork<NodeRef>()
|
||||
RetryingTransactionCallback<NodeRef> createDirectoryWork = new RetryingTransactionCallback<NodeRef>()
|
||||
{
|
||||
public NodeRef doWork() throws Exception
|
||||
public NodeRef execute() throws Exception
|
||||
{
|
||||
return createDirectory(container, file);
|
||||
}
|
||||
@@ -196,13 +197,11 @@ public class FileImporterImpl implements FileImporter
|
||||
NodeRef directoryNodeRef = null;
|
||||
if (txnPerFile)
|
||||
{
|
||||
directoryNodeRef = TransactionUtil.executeInUserTransaction(
|
||||
transactionService,
|
||||
createDirectoryWork);
|
||||
directoryNodeRef = txnHelper.doInTransaction(createDirectoryWork);
|
||||
}
|
||||
else
|
||||
{
|
||||
directoryNodeRef = createDirectoryWork.doWork();
|
||||
directoryNodeRef = createDirectoryWork.execute();
|
||||
}
|
||||
|
||||
if (recurse)
|
||||
@@ -219,9 +218,9 @@ public class FileImporterImpl implements FileImporter
|
||||
else
|
||||
{
|
||||
counter.increment();
|
||||
TransactionWork<NodeRef> createFileWork = new TransactionWork<NodeRef>()
|
||||
RetryingTransactionCallback<NodeRef> createFileWork = new RetryingTransactionCallback<NodeRef>()
|
||||
{
|
||||
public NodeRef doWork() throws Exception
|
||||
public NodeRef execute() throws Exception
|
||||
{
|
||||
return createFile(container, file);
|
||||
}
|
||||
@@ -229,13 +228,11 @@ public class FileImporterImpl implements FileImporter
|
||||
NodeRef fileNodeRef = null;
|
||||
if (txnPerFile)
|
||||
{
|
||||
fileNodeRef = TransactionUtil.executeInUserTransaction(
|
||||
transactionService,
|
||||
createFileWork);
|
||||
fileNodeRef = txnHelper.doInTransaction(createFileWork);
|
||||
}
|
||||
else
|
||||
{
|
||||
fileNodeRef = createFileWork.doWork();
|
||||
fileNodeRef = createFileWork.execute();
|
||||
}
|
||||
return fileNodeRef;
|
||||
}
|
||||
|
@@ -37,7 +37,7 @@ import org.alfresco.repo.dictionary.DictionaryDAO;
|
||||
import org.alfresco.repo.dictionary.M2Model;
|
||||
import org.alfresco.repo.node.BaseNodeServiceTest;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
@@ -113,11 +113,10 @@ public class RhinoScriptTest extends TestCase
|
||||
|
||||
public void testRhinoIntegration()
|
||||
{
|
||||
TransactionUtil.executeInUserTransaction(
|
||||
transactionService,
|
||||
new TransactionUtil.TransactionWork<Object>()
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(
|
||||
new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
// check that rhino script engine is available
|
||||
Context cx = Context.enter();
|
||||
@@ -161,11 +160,10 @@ public class RhinoScriptTest extends TestCase
|
||||
|
||||
public void testJSObjectWrapping()
|
||||
{
|
||||
TransactionUtil.executeInUserTransaction(
|
||||
transactionService,
|
||||
new TransactionUtil.TransactionWork<Object>()
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(
|
||||
new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
StoreRef store = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "rhino_" + System.currentTimeMillis());
|
||||
NodeRef root = nodeService.getRootNode(store);
|
||||
@@ -215,11 +213,10 @@ public class RhinoScriptTest extends TestCase
|
||||
|
||||
public void testScriptService()
|
||||
{
|
||||
TransactionUtil.executeInUserTransaction(
|
||||
transactionService,
|
||||
new TransactionUtil.TransactionWork<Object>()
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(
|
||||
new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
StoreRef store = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "rhino_" + System.currentTimeMillis());
|
||||
NodeRef root = nodeService.getRootNode(store);
|
||||
@@ -274,11 +271,10 @@ public class RhinoScriptTest extends TestCase
|
||||
|
||||
public void testScriptActions()
|
||||
{
|
||||
TransactionUtil.executeInUserTransaction(
|
||||
transactionService,
|
||||
new TransactionUtil.TransactionWork<Object>()
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(
|
||||
new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
StoreRef store = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "rhino_" + System.currentTimeMillis());
|
||||
NodeRef root = nodeService.getRootNode(store);
|
||||
@@ -329,11 +325,10 @@ public class RhinoScriptTest extends TestCase
|
||||
|
||||
public void xtestScriptActionsMail()
|
||||
{
|
||||
TransactionUtil.executeInUserTransaction(
|
||||
transactionService,
|
||||
new TransactionUtil.TransactionWork<Object>()
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(
|
||||
new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
StoreRef store = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "rhino_" + System.currentTimeMillis());
|
||||
NodeRef root = nodeService.getRootNode(store);
|
||||
|
@@ -40,8 +40,7 @@ import org.alfresco.i18n.I18NUtil;
|
||||
import org.alfresco.repo.admin.registry.RegistryKey;
|
||||
import org.alfresco.repo.admin.registry.RegistryService;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.module.ModuleDependency;
|
||||
import org.alfresco.service.cmr.module.ModuleDetails;
|
||||
@@ -215,15 +214,15 @@ public class ModuleComponentHelper
|
||||
final Set<String> startedModules = new HashSet<String>(2);
|
||||
for (final ModuleDetails module : modules)
|
||||
{
|
||||
TransactionWork<Object> startModuleWork = new TransactionWork<Object>()
|
||||
RetryingTransactionCallback<Object> startModuleWork = new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
startModule(module, startedModules, executedComponents);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
TransactionUtil.executeInNonPropagatingUserTransaction(transactionService, startModuleWork);
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(startModuleWork);
|
||||
}
|
||||
|
||||
// Check for missing modules.
|
||||
|
@@ -37,8 +37,7 @@ import org.alfresco.repo.dictionary.DictionaryDAO;
|
||||
import org.alfresco.repo.dictionary.M2Model;
|
||||
import org.alfresco.repo.node.integrity.IntegrityChecker;
|
||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
@@ -109,9 +108,9 @@ public class PerformanceNodeServiceTest extends TestCase
|
||||
contentService = (ContentService) applicationContext.getBean("contentService");
|
||||
|
||||
// create a first store directly
|
||||
TransactionWork<NodeRef> createStoreWork = new TransactionWork<NodeRef>()
|
||||
RetryingTransactionCallback<NodeRef> createStoreWork = new RetryingTransactionCallback<NodeRef>()
|
||||
{
|
||||
public NodeRef doWork()
|
||||
public NodeRef execute()
|
||||
{
|
||||
StoreRef storeRef = nodeService.createStore(
|
||||
StoreRef.PROTOCOL_WORKSPACE,
|
||||
@@ -119,7 +118,7 @@ public class PerformanceNodeServiceTest extends TestCase
|
||||
return nodeService.getRootNode(storeRef);
|
||||
}
|
||||
};
|
||||
rootNodeRef = TransactionUtil.executeInUserTransaction(txnService, createStoreWork);
|
||||
rootNodeRef = txnService.getRetryingTransactionHelper().doInTransaction(createStoreWork);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -165,16 +164,16 @@ public class PerformanceNodeServiceTest extends TestCase
|
||||
startTime = System.currentTimeMillis();
|
||||
|
||||
// ensure that we execute the node tree building in a transaction
|
||||
TransactionWork<Object> buildChildrenWork = new TransactionWork<Object>()
|
||||
RetryingTransactionCallback<Object> buildChildrenWork = new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork()
|
||||
public Object execute()
|
||||
{
|
||||
IntegrityChecker.setWarnInTransaction();
|
||||
buildNodeChildren(rootNodeRef, 1, testDepth, testChildCount);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
TransactionUtil.executeInUserTransaction(txnService, buildChildrenWork);
|
||||
txnService.getRetryingTransactionHelper().doInTransaction(buildChildrenWork);
|
||||
|
||||
long endTime = System.currentTimeMillis();
|
||||
|
||||
|
@@ -4,8 +4,7 @@ import java.util.List;
|
||||
|
||||
import org.alfresco.repo.node.index.FullIndexRecoveryComponent.RecoveryMode;
|
||||
import org.alfresco.repo.search.AVMSnapShotTriggeredIndexingMethodInterceptor;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.avm.AVMStoreDescriptor;
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -199,9 +198,9 @@ public class AVMFullIndexRecoveryComponent extends AbstractReindexComponent
|
||||
logger.debug("Reindexing avm store: " + store + " snapshot id " + id);
|
||||
}
|
||||
|
||||
TransactionWork<Object> reindexWork = new TransactionWork<Object>()
|
||||
RetryingTransactionCallback<Object> reindexWork = new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
if (!avmSnapShotTriggeredIndexingMethodInterceptor.isSnapshotIndexed(store, id))
|
||||
{
|
||||
@@ -211,7 +210,7 @@ public class AVMFullIndexRecoveryComponent extends AbstractReindexComponent
|
||||
return null;
|
||||
}
|
||||
};
|
||||
TransactionUtil.executeInNonPropagatingUserTransaction(transactionService, reindexWork, true);
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(reindexWork, true);
|
||||
// done
|
||||
}
|
||||
|
||||
|
@@ -39,8 +39,7 @@ import org.alfresco.repo.search.impl.lucene.fts.FullTextSearchIndexer;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.transaction.TransactionServiceImpl;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
@@ -210,15 +209,15 @@ public abstract class AbstractReindexComponent implements IndexRecovery
|
||||
auth = AuthenticationUtil.getCurrentAuthentication();
|
||||
// authenticate as the system user
|
||||
authenticationComponent.setSystemUserAsCurrentUser();
|
||||
TransactionWork<Object> reindexWork = new TransactionWork<Object>()
|
||||
RetryingTransactionCallback<Object> reindexWork = new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
reindexImpl();
|
||||
return null;
|
||||
}
|
||||
};
|
||||
TransactionUtil.executeInUserTransaction(transactionService, reindexWork);
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(reindexWork);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -426,9 +425,9 @@ public abstract class AbstractReindexComponent implements IndexRecovery
|
||||
logger.debug("Reindexing transaction: " + txnId);
|
||||
}
|
||||
|
||||
TransactionWork<Object> reindexWork = new TransactionWork<Object>()
|
||||
RetryingTransactionCallback<Object> reindexWork = new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
// get the node references pertinent to the transaction
|
||||
List<NodeRef> nodeRefs = nodeDaoService.getTxnChanges(txnId);
|
||||
@@ -461,7 +460,7 @@ public abstract class AbstractReindexComponent implements IndexRecovery
|
||||
return null;
|
||||
}
|
||||
};
|
||||
TransactionUtil.executeInNonPropagatingUserTransaction(transactionService, reindexWork, true);
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(reindexWork, true);
|
||||
// done
|
||||
}
|
||||
}
|
@@ -29,8 +29,7 @@ import java.util.List;
|
||||
import org.alfresco.i18n.I18NUtil;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.domain.Transaction;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef.Status;
|
||||
@@ -243,9 +242,9 @@ public class FullIndexRecoveryComponent extends AbstractReindexComponent
|
||||
logger.debug("Reindexing transaction: " + txnId);
|
||||
}
|
||||
|
||||
TransactionWork<Object> reindexWork = new TransactionWork<Object>()
|
||||
RetryingTransactionCallback<Object> reindexWork = new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
// get the node references pertinent to the transaction
|
||||
List<NodeRef> nodeRefs = nodeDaoService.getTxnChanges(txnId);
|
||||
@@ -278,7 +277,7 @@ public class FullIndexRecoveryComponent extends AbstractReindexComponent
|
||||
return null;
|
||||
}
|
||||
};
|
||||
TransactionUtil.executeInNonPropagatingUserTransaction(transactionService, reindexWork, true);
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(reindexWork, true);
|
||||
// done
|
||||
}
|
||||
}
|
@@ -33,8 +33,7 @@ import org.alfresco.repo.search.Indexer;
|
||||
import org.alfresco.repo.search.impl.lucene.fts.FullTextSearchIndexer;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
import org.alfresco.repo.transaction.TransactionServiceImpl;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.model.FileFolderService;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
@@ -95,9 +94,9 @@ public class IndexRemoteTransactionTrackerTest extends TestCase
|
||||
authenticationComponent.setSystemUserAsCurrentUser();
|
||||
|
||||
// disable indexing
|
||||
TransactionWork<ChildAssociationRef> createNodeWork = new TransactionWork<ChildAssociationRef>()
|
||||
RetryingTransactionCallback<ChildAssociationRef> createNodeWork = new RetryingTransactionCallback<ChildAssociationRef>()
|
||||
{
|
||||
public ChildAssociationRef doWork() throws Exception
|
||||
public ChildAssociationRef execute() throws Exception
|
||||
{
|
||||
StoreRef storeRef = new StoreRef("test", getName() + "-" + System.currentTimeMillis());
|
||||
NodeRef rootNodeRef = null;
|
||||
@@ -117,7 +116,7 @@ public class IndexRemoteTransactionTrackerTest extends TestCase
|
||||
return childAssocRef;
|
||||
}
|
||||
};
|
||||
ChildAssociationRef childAssocRef = TransactionUtil.executeInUserTransaction(transactionService, createNodeWork);
|
||||
ChildAssociationRef childAssocRef = transactionService.getRetryingTransactionHelper().doInTransaction(createNodeWork);
|
||||
}
|
||||
|
||||
public void testSetup() throws Exception
|
||||
|
@@ -27,8 +27,7 @@ package org.alfresco.repo.node.index;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.search.impl.lucene.AbstractLuceneIndexerImpl;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.search.ResultSet;
|
||||
@@ -113,15 +112,15 @@ public class MissingContentReindexComponent extends AbstractReindexComponent
|
||||
{
|
||||
final NodeRef childNodeRef = row.getNodeRef();
|
||||
// prompt for a reindex - it might fail again, but we just keep plugging away
|
||||
TransactionWork<Object> reindexWork = new TransactionWork<Object>()
|
||||
RetryingTransactionCallback<Object> reindexWork = new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork()
|
||||
public Object execute()
|
||||
{
|
||||
indexer.updateNode(childNodeRef);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
TransactionUtil.executeInNonPropagatingUserTransaction(transactionService, reindexWork);
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(reindexWork);
|
||||
// check if we have to break out
|
||||
if (isShuttingDown())
|
||||
{
|
||||
|
@@ -46,8 +46,7 @@ import org.alfresco.repo.search.impl.lucene.index.IndexInfo;
|
||||
import org.alfresco.repo.search.transaction.SimpleTransaction;
|
||||
import org.alfresco.repo.search.transaction.SimpleTransactionManager;
|
||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
@@ -965,15 +964,15 @@ public abstract class AbstractLuceneIndexerAndSearcherFactory implements LuceneI
|
||||
*/
|
||||
public void backup()
|
||||
{
|
||||
TransactionWork<Object> backupWork = new TransactionWork<Object>()
|
||||
RetryingTransactionCallback<Object> backupWork = new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
backupImpl();
|
||||
return null;
|
||||
}
|
||||
};
|
||||
TransactionUtil.executeInUserTransaction(transactionService, backupWork);
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(backupWork);
|
||||
}
|
||||
|
||||
private void backupImpl()
|
||||
|
@@ -19,7 +19,7 @@ package org.alfresco.repo.security.person;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
||||
@@ -78,11 +78,10 @@ public class SplitPersonCleanupBootstrapBean extends AbstractLifecycleBean
|
||||
*/
|
||||
private int removePeopleWithGUIDBasedIds()
|
||||
{
|
||||
Integer count = TransactionUtil.executeInUserTransaction(transactionService,
|
||||
new TransactionUtil.TransactionWork<Integer>()
|
||||
Integer count = transactionService.getRetryingTransactionHelper().doInTransaction(
|
||||
new RetryingTransactionCallback<Integer>()
|
||||
{
|
||||
|
||||
public Integer doWork() throws Exception
|
||||
public Integer execute() throws Exception
|
||||
{
|
||||
int count = 0;
|
||||
// A GUID should be 36 chars
|
||||
@@ -121,6 +120,7 @@ public class SplitPersonCleanupBootstrapBean extends AbstractLifecycleBean
|
||||
String guidString = uid.substring(uid.length() - 36);
|
||||
try
|
||||
{
|
||||
@SuppressWarnings("unused")
|
||||
UUID id = new UUID(guidString);
|
||||
// We have a valid guid.
|
||||
return true;
|
||||
@@ -140,6 +140,7 @@ public class SplitPersonCleanupBootstrapBean extends AbstractLifecycleBean
|
||||
guidString = guidString.substring(1, 37);
|
||||
try
|
||||
{
|
||||
@SuppressWarnings("unused")
|
||||
UUID id = new UUID(guidString);
|
||||
// We have a valid guid.
|
||||
return true;
|
||||
|
@@ -34,11 +34,9 @@ import org.alfresco.repo.dictionary.DictionaryComponent;
|
||||
import org.alfresco.repo.dictionary.DictionaryDAO;
|
||||
import org.alfresco.repo.dictionary.M2Model;
|
||||
import org.alfresco.repo.node.BaseNodeServiceTest;
|
||||
import org.alfresco.repo.policy.PolicyComponent;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
@@ -54,7 +52,6 @@ public class TemplateServiceImplTest extends TestCase
|
||||
{
|
||||
private static final ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
|
||||
|
||||
private ContentService contentService;
|
||||
private TemplateService templateService;
|
||||
private NodeService nodeService;
|
||||
private TransactionService transactionService;
|
||||
@@ -68,11 +65,10 @@ public class TemplateServiceImplTest extends TestCase
|
||||
{
|
||||
super.setUp();
|
||||
|
||||
transactionService = (TransactionService)this.ctx.getBean("transactionComponent");
|
||||
contentService = (ContentService)this.ctx.getBean("contentService");
|
||||
nodeService = (NodeService)this.ctx.getBean("nodeService");
|
||||
templateService = (TemplateService)this.ctx.getBean("templateService");
|
||||
serviceRegistry = (ServiceRegistry)this.ctx.getBean("ServiceRegistry");
|
||||
transactionService = (TransactionService)ctx.getBean("transactionComponent");
|
||||
nodeService = (NodeService)ctx.getBean("nodeService");
|
||||
templateService = (TemplateService)ctx.getBean("templateService");
|
||||
serviceRegistry = (ServiceRegistry)ctx.getBean("ServiceRegistry");
|
||||
|
||||
this.authenticationComponent = (AuthenticationComponent)ctx.getBean("authenticationComponent");
|
||||
this.authenticationComponent.setSystemUserAsCurrentUser();
|
||||
@@ -106,12 +102,11 @@ public class TemplateServiceImplTest extends TestCase
|
||||
|
||||
public void testTemplates()
|
||||
{
|
||||
TransactionUtil.executeInUserTransaction(
|
||||
transactionService,
|
||||
new TransactionUtil.TransactionWork<Object>()
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(
|
||||
new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
StoreRef store = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "template_" + System.currentTimeMillis());
|
||||
NodeRef root = nodeService.getRootNode(store);
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -34,7 +34,6 @@ import java.util.Set;
|
||||
import org.alfresco.model.ApplicationModel;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.model.FileFolderService;
|
||||
@@ -472,9 +471,9 @@ public class VersionServiceImplTest extends BaseVersionStoreTest
|
||||
setComplete();
|
||||
endTransaction();
|
||||
|
||||
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionUtil.TransactionWork<Object>()
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
// Check that the initial version has not been created
|
||||
VersionHistory versionHistory = VersionServiceImplTest.this.versionService.getVersionHistory(versionableNode);
|
||||
@@ -491,9 +490,9 @@ public class VersionServiceImplTest extends BaseVersionStoreTest
|
||||
});
|
||||
|
||||
// Now lets have a look and make sure we have the correct number of entries in the version history
|
||||
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionUtil.TransactionWork<Object>()
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
VersionHistory versionHistory = VersionServiceImplTest.this.versionService.getVersionHistory(versionableNode);
|
||||
assertNotNull(versionHistory);
|
||||
@@ -516,9 +515,9 @@ public class VersionServiceImplTest extends BaseVersionStoreTest
|
||||
|
||||
// The initial version should have been created now
|
||||
|
||||
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionUtil.TransactionWork<Object>()
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
// Add some content
|
||||
ContentWriter contentWriter = VersionServiceImplTest.this.contentService.getWriter(versionableNode, ContentModel.PROP_CONTENT, true);
|
||||
@@ -530,9 +529,9 @@ public class VersionServiceImplTest extends BaseVersionStoreTest
|
||||
});
|
||||
|
||||
// Now lets have a look and make sure we have the correct number of entries in the version history
|
||||
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionUtil.TransactionWork<Object>()
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
VersionHistory versionHistory = VersionServiceImplTest.this.versionService.getVersionHistory(versionableNode);
|
||||
assertNotNull(versionHistory);
|
||||
@@ -564,9 +563,9 @@ public class VersionServiceImplTest extends BaseVersionStoreTest
|
||||
|
||||
// The initial version should NOT have been created
|
||||
|
||||
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionUtil.TransactionWork<Object>()
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
VersionHistory versionHistory = VersionServiceImplTest.this.versionService.getVersionHistory(nodeRef);
|
||||
assertNull(versionHistory);
|
||||
@@ -592,9 +591,9 @@ public class VersionServiceImplTest extends BaseVersionStoreTest
|
||||
setComplete();
|
||||
endTransaction();
|
||||
|
||||
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionUtil.TransactionWork<Object>()
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
// Check that the version history has been created
|
||||
VersionHistory versionHistory = VersionServiceImplTest.this.versionService.getVersionHistory(nodeRef);
|
||||
@@ -608,9 +607,9 @@ public class VersionServiceImplTest extends BaseVersionStoreTest
|
||||
}
|
||||
});
|
||||
|
||||
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionUtil.TransactionWork<Object>()
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
// Check that the version history has been removed
|
||||
VersionHistory versionHistory = VersionServiceImplTest.this.versionService.getVersionHistory(nodeRef);
|
||||
@@ -623,9 +622,9 @@ public class VersionServiceImplTest extends BaseVersionStoreTest
|
||||
}
|
||||
});
|
||||
|
||||
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionUtil.TransactionWork<Object>()
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
// Check that the version history has been created
|
||||
VersionHistory versionHistory = VersionServiceImplTest.this.versionService.getVersionHistory(nodeRef);
|
||||
@@ -655,9 +654,9 @@ public class VersionServiceImplTest extends BaseVersionStoreTest
|
||||
setComplete();
|
||||
endTransaction();
|
||||
|
||||
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionUtil.TransactionWork<Object>()
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
VersionHistory versionHistory = VersionServiceImplTest.this.versionService.getVersionHistory(nodeRef);
|
||||
assertNotNull(versionHistory);
|
||||
@@ -670,9 +669,9 @@ public class VersionServiceImplTest extends BaseVersionStoreTest
|
||||
}
|
||||
});
|
||||
|
||||
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionUtil.TransactionWork<Object>()
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
// Get the archived noderef
|
||||
NodeRef archivedNodeRef = VersionServiceImplTest.this.nodeArchiveService.getArchivedNode(nodeRef);
|
||||
|
@@ -32,8 +32,7 @@ import javax.transaction.UserTransaction;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
@@ -157,9 +156,9 @@ public class VersionCounterServiceTest extends TestCase
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
TransactionWork<Object> versionWork = new TransactionWork<Object>()
|
||||
RetryingTransactionCallback<Object> versionWork = new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
// wait for all other threads to enter into their transactions
|
||||
startSignal.countDown();
|
||||
@@ -174,7 +173,7 @@ public class VersionCounterServiceTest extends TestCase
|
||||
};
|
||||
try
|
||||
{
|
||||
TransactionUtil.executeInNonPropagatingUserTransaction(transactionService, versionWork, false);
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(versionWork, false);
|
||||
error = null;
|
||||
}
|
||||
catch (Throwable e)
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user