|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.commerce.util.TransactionLockFactory
public class TransactionLockFactory
The transaction lock factory is used to grab locks before beginning and ending a transaction. To use:
TransactionLockFactory tlf = getTransactionLockFactory(); TransactionLockService lockService = tlf.getServiceInstance(this); try { lockService.acquireTransactionLock(); } catch (DeadlockException de) { // log something } try { // perform your work in a transaction } finally { try { lockService.releaseTransactionLock(); } catch (LockManagerException lme) { // log something } }By default, the key used to retrieve the lock is the current profile id. To change this, pass in your own key to
getServiceInstance
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
Fields inherited from class atg.nucleus.GenericService |
---|
SERVICE_INFO_KEY |
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging |
---|
DEFAULT_LOG_TRACE_STATUS |
Fields inherited from interface atg.nucleus.logging.ApplicationLogging |
---|
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS |
Constructor Summary | |
---|---|
TransactionLockFactory()
|
Method Summary | |
---|---|
ClientLockManager |
getLocalLockManager()
Return the lock manager to use if useLocksAroundTransactions
is true. |
RepositoryItem |
getProfile()
Return the current user profile. |
TransactionLockService |
getServiceInstance()
Get a new TransactionLockService with all the default settings.. |
TransactionLockService |
getServiceInstance(ApplicationLogging pLogger)
Get a new TransactionLockService with all the default settings. |
TransactionLockService |
getServiceInstance(java.lang.String pLockName)
Get a new TransactionLockService but instead of using the default transactionLockName, use the given lock name. |
TransactionLockService |
getServiceInstance(java.lang.String pLockName,
ApplicationLogging pLogger)
Get a new TransactionLockService but instead of using the default transactionLockName, use the given lock name. |
protected java.lang.String |
getTransactionLockName()
Generate the lock name to use when acquiring and releasing locks in acquireTransactionLock and releaseTransactionLock . |
boolean |
isUseLocksAroundTransactions()
Inquire whether to use a local lock manager to obtain a lock before starting transactions, and to release the lock after committing transactions. |
void |
setLocalLockManager(ClientLockManager pLocalLockManager)
Specify the lock manager to use if useLocksAroundTransactions
is true. |
void |
setUseLocksAroundTransactions(boolean pUseLocksAroundTransactions)
Specify whether to use a local lock manager to obtain a lock before starting transactions and to release the lock after committing transacations. |
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLASS_VERSION
Constructor Detail |
---|
public TransactionLockFactory()
Method Detail |
---|
public void setUseLocksAroundTransactions(boolean pUseLocksAroundTransactions)
If this property is set to true, locking will be used to prevent one
user from trying to modify orders in multiple concurrent threads.
This has a small performance impact as we obtain and release the lock,
but minimizes the possibility of concurrent update exceptions if
two threads try to modify the same order for the same user.
The default value for useLocksAroundTransactions
is true.
public boolean isUseLocksAroundTransactions()
public void setLocalLockManager(ClientLockManager pLocalLockManager)
useLocksAroundTransactions
is true.
setUseLocksAroundTransactions(boolean)
public ClientLockManager getLocalLockManager()
useLocksAroundTransactions
is true.
setUseLocksAroundTransactions(boolean)
public RepositoryItem getProfile()
RepositoryItem
valuepublic TransactionLockService getServiceInstance()
public TransactionLockService getServiceInstance(java.lang.String pLockName)
pLockName
- The name to use when acquiring and releasing locks.
public TransactionLockService getServiceInstance(ApplicationLogging pLogger)
pLogger
- The logger used by the returned TransactionLockService
public TransactionLockService getServiceInstance(java.lang.String pLockName, ApplicationLogging pLogger)
pLockName
- The name to use when acquiring and releasing locks.pLogger
- The logger used by the returned TransactionLockService
protected java.lang.String getTransactionLockName()
acquireTransactionLock
and releaseTransactionLock
.
By default this returns the repository id of the current user profile,
generating an error message and returning null if no profile is available.
Subclasses may override this behavior to choose a different locking
strategy.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |