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:
Derek Hulley
2007-06-13 23:50:14 +00:00
parent 36ea25f822
commit fb069d1680
19 changed files with 940 additions and 186 deletions

View File

@@ -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;
}
}
}

View File

@@ -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)