mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
More fussing with lookup cache. It seems a hair faster.
Some cleanup of the retrying transaction stuff. Minor mods to one stress test to account for changes to retrying transactions. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4616 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -5,7 +5,6 @@ package org.alfresco.repo.transaction;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.apache.log4j.Logger;
|
||||
@@ -104,37 +103,44 @@ public class RetryingTransactionAdvice implements MethodInterceptor
|
||||
}
|
||||
return result;
|
||||
}
|
||||
catch (Throwable e)
|
||||
catch (RuntimeException e)
|
||||
{
|
||||
if (txn != null && isNewTxn && !txn.isCompleted())
|
||||
{
|
||||
fTxnManager.rollback(txn);
|
||||
}
|
||||
if (e instanceof ConcurrencyFailureException ||
|
||||
e instanceof DeadlockLoserDataAccessException ||
|
||||
e instanceof StaleObjectStateException ||
|
||||
e instanceof LockAcquisitionException)
|
||||
if (!isNewTxn)
|
||||
{
|
||||
if (!isNewTxn)
|
||||
throw e;
|
||||
}
|
||||
lastException = e;
|
||||
Throwable t = e;
|
||||
boolean shouldRetry = false;
|
||||
while (t != null)
|
||||
{
|
||||
if (t instanceof ConcurrencyFailureException ||
|
||||
t instanceof DeadlockLoserDataAccessException ||
|
||||
t instanceof StaleObjectStateException ||
|
||||
t instanceof LockAcquisitionException)
|
||||
{
|
||||
throw (RuntimeException)e;
|
||||
}
|
||||
lastException = (RuntimeException)e;
|
||||
try
|
||||
{
|
||||
Thread.sleep(fRandom.nextInt(500 * count + 500));
|
||||
}
|
||||
catch (InterruptedException ie)
|
||||
{
|
||||
// Do nothing.
|
||||
shouldRetry = true;
|
||||
try
|
||||
{
|
||||
Thread.sleep(fRandom.nextInt(500 * count + 500));
|
||||
}
|
||||
catch (InterruptedException ie)
|
||||
{
|
||||
// Do nothing.
|
||||
}
|
||||
break;
|
||||
}
|
||||
t = t.getCause();
|
||||
}
|
||||
if (shouldRetry)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (e instanceof RuntimeException)
|
||||
{
|
||||
throw (RuntimeException)e;
|
||||
}
|
||||
throw new AlfrescoRuntimeException("Failure in Transaction.", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
fgLogger.error("Txn Failed after " + fMaxRetries + " retries:", lastException);
|
||||
|
Reference in New Issue
Block a user