public class TransactionServiceImpl extends Object implements TransactionService
Default retry behaviour: see RetryingTransactionHelper.RetryingTransactionHelper()
Constructor and Description |
---|
TransactionServiceImpl()
Construct defaults
|
Modifier and Type | Method and Description |
---|---|
boolean |
getAllowWrite()
Determine if the repository has been put into read only mode.
|
UserTransaction |
getNonPropagatingUserTransaction()
Gets a user transaction that ensures a new transaction is created.
|
UserTransaction |
getNonPropagatingUserTransaction(boolean readOnly)
Gets a user transaction that ensures a new transaction is created.
|
UserTransaction |
getNonPropagatingUserTransaction(boolean readOnly,
boolean ignoreSystemReadOnly)
Gets a user transaction that ensures a new transaction is created.
|
RetryingTransactionHelper |
getRetryingTransactionHelper()
Creates a new helper instance.
|
UserTransaction |
getUserTransaction()
Gets a user transaction that supports transaction propagation.
|
UserTransaction |
getUserTransaction(boolean readOnly)
Gets a user transaction that supports transaction propagation.
|
UserTransaction |
getUserTransaction(boolean readOnly,
boolean ignoreSystemReadOnly)
Gets a user transaction that supports transaction propagation.
|
boolean |
isReadOnly()
Determine if ALL user transactions will be read-only.
|
void |
setAllowWrite(boolean allowWrite)
Set the read-only mode for all generated transactions.
|
void |
setAllowWrite(boolean allowWrite,
org.alfresco.service.namespace.QName nameOfVeto)
Set the read-only mode for all generated transactions.
|
void |
setMaxRetries(int maxRetries) |
void |
setMaxRetryWaitMs(int maxRetryWaitMs) |
void |
setMinRetryWaitMs(int minRetryWaitMs) |
void |
setRetryWaitIncrementMs(int retryWaitIncrementMs) |
void |
setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
Set the transaction manager to use
|
public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
public boolean getAllowWrite()
getAllowWrite
in interface TransactionService
public void setAllowWrite(boolean allowWrite)
Intended for use by spring configuration only. Alfresco code should call the method which specifies a veto name.
allowWrite
- false if all transactions must be read-onlypublic void setAllowWrite(boolean allowWrite, org.alfresco.service.namespace.QName nameOfVeto)
By default read/write transactions are allowed however vetos may be applied that make the transactions read only.
Prevent writes by calling allowWrite with false and a given veto name.
The veto is removed by calling allowWrite with true for the given veto name when all vetos are removed then read/write transactions are allowed.
allowWrite
- false if all transactions must be read-onlynameOfVeto
- the name of the vetopublic boolean isReadOnly()
isReadOnly
in interface TransactionService
public void setMaxRetries(int maxRetries)
public void setMinRetryWaitMs(int minRetryWaitMs)
public void setMaxRetryWaitMs(int maxRetryWaitMs)
public void setRetryWaitIncrementMs(int retryWaitIncrementMs)
public UserTransaction getUserTransaction()
TransactionService
getUserTransaction
in interface TransactionService
TransactionDefinition.PROPAGATION_REQUIRED
public UserTransaction getUserTransaction(boolean readOnly)
TransactionService
getUserTransaction
in interface TransactionService
readOnly
- Set true for a READONLY transaction instance, false otherwise.
Note that it is not always possible to force a write transaction if the
system is in read-only mode.TransactionDefinition.PROPAGATION_REQUIRED
public UserTransaction getUserTransaction(boolean readOnly, boolean ignoreSystemReadOnly)
TransactionService
getUserTransaction
in interface TransactionService
readOnly
- Set true for a READONLY transaction instance, false otherwise.ignoreSystemReadOnly
- true to force the read-only flag to be respected regardless
of the system read-only mode.TransactionDefinition.PROPAGATION_REQUIRED
public UserTransaction getNonPropagatingUserTransaction()
TransactionService
getNonPropagatingUserTransaction
in interface TransactionService
TransactionDefinition.PROPAGATION_REQUIRES_NEW
public UserTransaction getNonPropagatingUserTransaction(boolean readOnly)
TransactionService
getNonPropagatingUserTransaction
in interface TransactionService
readOnly
- Set true for a READONLY transaction instance, false otherwise.
Note that it is not always possible to force a write transaction if the
system is in read-only mode.TransactionDefinition.PROPAGATION_REQUIRES_NEW
public UserTransaction getNonPropagatingUserTransaction(boolean readOnly, boolean ignoreSystemReadOnly)
TransactionService
getNonPropagatingUserTransaction
in interface TransactionService
readOnly
- Set true for a READONLY transaction instance, false otherwise.ignoreSystemReadOnly
- true to force the read-only flag to be respected regardless
of the system read-only mode.TransactionDefinition.PROPAGATION_REQUIRES_NEW
public RetryingTransactionHelper getRetryingTransactionHelper()
getRetryingTransactionHelper
in interface TransactionService
Copyright © 2005–2017 Alfresco Software. All rights reserved.