mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged DEV/DEREK_2.1 to HEAD
- Removed Node.parentAssocs mapping - Added parentAssocs transactional cache to NodeDAO - Added concurrency detection to TransactionalCache - Fixed cluster sample config git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5948 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package org.alfresco.repo.transaction;
|
||||
|
||||
import java.sql.BatchUpdateException;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.transaction.Status;
|
||||
@@ -62,7 +63,8 @@ public class RetryingTransactionHelper
|
||||
ConcurrencyFailureException.class,
|
||||
DeadlockLoserDataAccessException.class,
|
||||
StaleObjectStateException.class,
|
||||
LockAcquisitionException.class
|
||||
LockAcquisitionException.class,
|
||||
BatchUpdateException.class
|
||||
};
|
||||
}
|
||||
|
||||
@@ -274,7 +276,7 @@ public class RetryingTransactionHelper
|
||||
lastException = (e instanceof RuntimeException) ?
|
||||
(RuntimeException)e : new AlfrescoRuntimeException("Unknown Exception in Transaction.", e);
|
||||
// Check if there is a cause for retrying
|
||||
Throwable retryCause = ExceptionStackUtil.getCause(e, RETRY_EXCEPTIONS);
|
||||
Throwable retryCause = extractRetryCause(e);
|
||||
if (retryCause != null)
|
||||
{
|
||||
// Sleep a random amount of time before retrying.
|
||||
@@ -301,4 +303,36 @@ public class RetryingTransactionHelper
|
||||
// So, fail.
|
||||
throw lastException;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sometimes, the exception means retry and sometimes not.
|
||||
*
|
||||
* @param cause the cause to examine
|
||||
* @return Returns the original cause if it is a valid retry cause, otherwise <tt>null</tt>
|
||||
*/
|
||||
private Throwable extractRetryCause(Throwable cause)
|
||||
{
|
||||
Throwable retryCause = ExceptionStackUtil.getCause(cause, RETRY_EXCEPTIONS);
|
||||
if (retryCause == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else if (retryCause instanceof BatchUpdateException)
|
||||
{
|
||||
if (retryCause.getMessage().contains("Lock wait"))
|
||||
{
|
||||
// It is valid
|
||||
return retryCause;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not valid
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return retryCause;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -203,7 +203,7 @@ public class TransactionUtil
|
||||
{
|
||||
// commit failed
|
||||
throw new AlfrescoRuntimeException(
|
||||
"Unexpected rollback of exception: \n" + exception.getMessage(),
|
||||
"Unexpected rollback exception: \n" + exception.getMessage(),
|
||||
exception);
|
||||
}
|
||||
catch (Throwable exception)
|
||||
|
Reference in New Issue
Block a user