Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)

59123: Merged V4.2-BUG-FIX (4.2.1) to HEAD-BUG-FIX (Cloud/4.3)
      59111: Merged V4.1-BUG-FIX (4.1.8) to V4.2-BUG-FIX (4.2.1)
         59070: Merged DEV to V4.1-BUG-FIX (4.1.8)
            58849: MNT-10096: MT: AbstractTenantRoutingContentStore can return null list of stores
              - Ensure that RetryingTransactionHelper starts a transaction in txn-after-completion phase (MNT-9806).


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62103 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-02-12 01:06:17 +00:00
parent 68bfd2b72e
commit 8a8cf1b81a
3 changed files with 67 additions and 15 deletions

View File

@@ -366,8 +366,7 @@ public class RetryingTransactionHelper
}
// First validate the requiresNew setting
boolean startingNew = requiresNew;
if (!startingNew)
if (!requiresNew)
{
TxnReadState readState = AlfrescoTransactionSupport.getTransactionReadState();
switch (readState)
@@ -385,7 +384,7 @@ public class RetryingTransactionHelper
break;
case TXN_NONE:
// There is no current transaction so we need a new one.
startingNew = true;
requiresNew = true;
break;
default:
throw new RuntimeException("Unknown transaction state: " + readState);
@@ -395,7 +394,7 @@ public class RetryingTransactionHelper
// If we are time limiting, set ourselves a time limit and maintain the count of concurrent transactions
long startTime = 0;
Throwable stackTrace = null;
if (startingNew && maxExecutionMs > 0)
if (requiresNew && maxExecutionMs > 0)
{
startTime = System.currentTimeMillis();
synchronized (this)
@@ -433,11 +432,10 @@ public class RetryingTransactionHelper
UserTransaction txn = null;
try
{
if (startingNew)
if (requiresNew)
{
txn = requiresNew ?
txnService.getNonPropagatingUserTransaction(readOnly, forceWritable) :
txnService.getUserTransaction(readOnly, forceWritable);
txn = txnService.getNonPropagatingUserTransaction(readOnly, forceWritable);
txn.begin();
// Wrap it to protect it
UserTransactionProtectionAdvise advise = new UserTransactionProtectionAdvise();
@@ -588,7 +586,7 @@ public class RetryingTransactionHelper
}
finally
{
if (startingNew && maxExecutionMs > 0)
if (requiresNew && maxExecutionMs > 0)
{
synchronized (this)
{