|
Defaults:
To get details of 'why' transactions are retried use the following log level:
Summary: log4j.logger.org.alfresco.repo.transaction.RetryingTransactionHelper=INFO
Details: log4j.logger.org.alfresco.repo.transaction.RetryingTransactionHelper=DEBUG
Nested Class Summary | ||
static interface |
RetryingTransactionHelper.RetryingTransactionCallback<Result> Callback interface |
Field Summary | ||
static Class[] |
RETRY_EXCEPTIONS Exceptions that trigger retries. |
Constructor Summary | ||
RetryingTransactionHelper() Default constructor. |
Method Summary | ||
<R> R |
doInTransaction(RetryingTransactionHelper.RetryingTransactionCallback<R> cb) Execute a callback in a transaction until it succeeds, fails because of an error not the result of an optimistic locking failure, or a deadlock loser failure, or until a maximum number of retries have been attempted. |
|
<R> R |
doInTransaction(RetryingTransactionHelper.RetryingTransactionCallback<R> cb, boolean readOnly) Execute a callback in a transaction until it succeeds, fails because of an error not the result of an optimistic locking failure, or a deadlock loser failure, or until a maximum number of retries have been attempted. |
|
<R> R |
doInTransaction(RetryingTransactionHelper.RetryingTransactionCallback<R> cb, boolean readOnly, boolean requiresNew) Execute a callback in a transaction until it succeeds, fails because of an error not the result of an optimistic locking failure, or a deadlock loser failure, or until a maximum number of retries have been attempted. |
|
static Throwable |
extractRetryCause(Throwable cause) Sometimes, the exception means retry and sometimes not. |
|
static UserTransaction |
getActiveUserTransaction() Utility method to get the active transaction. |
|
void |
setExtraExceptions(List<Class<?>> extraExceptions) Set the list of extra exceptions that should be retried |
|
void |
setForceWritable(boolean forceWritable) Override to allow the transactions to be writable regardless of the system read-only mode. |
|
void |
setMaxExecutionMs(long maxExecutionMs) | |
void |
setMaxRetries(int maxRetries) Set the maximimum number of retries. |
|
void |
setMaxRetryWaitMs(int maxRetryWaitMs) | |
void |
setMinRetryWaitMs(int minRetryWaitMs) | |
void |
setReadOnly(boolean readOnly) Set whether this helper only supports read transactions. |
|
void |
setRetryWaitIncrementMs(int retryWaitIncrementMs) | |
void |
setTransactionService(org.alfresco.service.transaction.TransactionService service) Set the TransactionService. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
If there is already an active transaction, then the callback is merely executed and any retry logic is left to the caller. The transaction will attempt to be read-write.
If there is already an active transaction, then the callback is merely executed and any retry logic is left to the caller.
It is possible to force a new transaction to be created or to partake in any existing transaction.
NOTE: Any attempt to actually commit or rollback the transaction will cause failures.
|