public class KKDBLockMgrEE extends BaseMgr implements KKLockMgrIf
Modifier and Type | Field and Description |
---|---|
protected static boolean |
initialised
Initialised?
|
protected static java.lang.String |
LOCK_APIS_ENABLED
Configuration Key values
|
protected static boolean |
LOCK_APIS_ENABLED_DEFAULT
Configuration Key Defaults
|
protected static java.lang.String |
LOCK_FAILURE_RE |
protected static java.lang.String |
LOCK_FAILURE_RE_DEFAULT |
protected static java.lang.String |
LOCK_SLEEP_MS |
protected static int |
LOCK_SLEEP_MS_DEFAULT |
protected static java.lang.String |
LOCK_TIMEOUT_MS |
protected static int |
LOCK_TIMEOUT_MS_DEFAULT |
protected static java.lang.String |
lockFailureRE
Lock Failure RE
|
protected static boolean |
lockingEnabled
Is locking enabled?
|
protected static org.apache.commons.logging.Log |
log
the log
|
protected static java.lang.String |
mutex
Mutex for the Manager
|
protected static java.lang.String |
RELEASE_FAILURE_RE |
protected static java.lang.String |
RELEASE_FAILURE_RE_DEFAULT |
protected static java.lang.String |
releaseFailureRE
Release Failure RE
|
protected static int |
sleepTimeMS
Sleep time in MS
|
protected static int |
timeoutMS
Timeout in MS
|
templateBaseDir
Constructor and Description |
---|
KKDBLockMgrEE(KKEngIf eng)
Constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
acquire(java.lang.String lockName)
Acquire a lock.
|
boolean |
acquire(java.lang.String lockName,
int sleepMS,
int _timeoutMS)
Acquire a lock.
|
protected boolean |
acquireLockSQL(java.lang.String lockname,
java.sql.Date now) |
static java.lang.String |
getLockFailureRE() |
static java.lang.String |
getReleaseFailureRE() |
static int |
getSleepTimeMS() |
static int |
getTimeoutMS() |
protected void |
initialise() |
static boolean |
isInitialised() |
static boolean |
isLockingEnabled() |
void |
refreshConfigs()
Refresh the configuration of the manager
|
void |
release(java.lang.String lockName)
Release a lock for the specified object.
|
protected boolean |
releaseLockSQL(java.lang.String lockName) |
static void |
setInitialised(boolean initialised) |
static void |
setLockFailureRE(java.lang.String lockFailureRE) |
static void |
setLockingEnabled(boolean lockingEnabled) |
static void |
setReleaseFailureRE(java.lang.String releaseFailureRE) |
static void |
setSleepTimeMS(int sleepTimeMS) |
static void |
setTimeoutMS(int timeoutMS) |
acquireLock, addInsertAttr, addInsertAttr, addStringRuleConstraint, addStringRuleConstraint, checkRequired, escapeHTML, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, getAdminEngMgr, getBasketMgr, getBillingMgr, getBookableProductMgr, getCacheMgr, getCatMgr, getConfigMgr, getCookieMgr, getCurrMgr, getCustMgr, getCustomerIdFromSession, getCustomerStatsMgr, getCustomerTagMgr, getEmailMgr, getEng, getEventMgr, getExportMgr, getHTMLEscaper, getKonaKartConfig, getKonaKartConfig, getKonaKartConfig, getLangMgr, getManuMgr, getMiscItemMgr, getMiscPriceMgr, getMode, getModeString, getMqMgr, getMultiStoreMgr, getNewCriteria, getNewCriteria, getOrderIntegrationMgr, getOrderMgr, getOrderTotalMgr, getPaymentMgr, getProdMgr, getProductsToCategoresCriteria, getPromMgr, getPunchOutMgr, getRewardPointMgr, getSecMgr, getShippingMgr, getSolrMgr, getStoreId, getStoreMgr, getStoreTime, getSuggestionMgr, getTaxMgr, getTemplate, getTemplateRoot, getVelocityContextMgr, getWishListMgr, init, insertKKEvent, insertKKEvent, isBusiness, isBusinessOrEnterprise, isClassPresent, isCommunity, isDeadlockException, isEnterprise, isMultiStoreShareCategories, isMultiStoreShareCustomers, isMultiStoreShareCustomersOrProducts, isMultiStoreSharedDb, isMultiStoreShareProducts, isMultiVendor, isUnix, manageThrowable, releaseLock, updateStaticVariablesNow
protected static final java.lang.String LOCK_APIS_ENABLED
protected static final java.lang.String LOCK_TIMEOUT_MS
protected static final java.lang.String LOCK_SLEEP_MS
protected static final java.lang.String LOCK_FAILURE_RE
protected static final java.lang.String RELEASE_FAILURE_RE
protected static final boolean LOCK_APIS_ENABLED_DEFAULT
protected static final int LOCK_TIMEOUT_MS_DEFAULT
protected static final int LOCK_SLEEP_MS_DEFAULT
protected static final java.lang.String LOCK_FAILURE_RE_DEFAULT
protected static final java.lang.String RELEASE_FAILURE_RE_DEFAULT
protected static org.apache.commons.logging.Log log
protected static java.lang.String mutex
protected static boolean lockingEnabled
protected static int sleepTimeMS
protected static int timeoutMS
protected static java.lang.String lockFailureRE
protected static java.lang.String releaseFailureRE
protected static boolean initialised
public KKDBLockMgrEE(KKEngIf eng) throws java.lang.Exception
eng
- An object that implements KKEngIfjava.lang.Exception
- an unexpected exceptionpublic boolean acquire(java.lang.String lockName) throws com.konakart.app.KKException
KKLockMgrIf
Guarantees to return a lock for the specified object (if locking is enabled).
It will sleep and retry until the timeout at which point it will remove any existing lock and acquire it for the current thread.
If locking is disabled this will return false without doing anything. The enabled/disabled state is set by the konakart.lockAPIs.enabled property in konakart.properties.
The sleep quantity is defined by the konakart.lockAPIs.sleepMS property in konakart.properties.
The timeout quantity is defined by the konakart.lockAPIs.timeoutMS property in konakart.properties.
acquire
in interface KKLockMgrIf
lockName
- the name of the object to acquire the lock for. Use any String less than 32
characters in length.com.konakart.app.KKException
- an unexpected KKException exceptionpublic boolean acquire(java.lang.String lockName, int sleepMS, int _timeoutMS) throws com.konakart.app.KKException
KKLockMgrIf
Guarantees to return a lock for the specified object (if locking is enabled).
It will sleep and retry until the timeout at which point it will remove any existing lock and acquire it for the current thread.
If locking is disabled this will return false without doing anything. The enabled/disabled state is set by the konakart.lockAPIs.enabled property in konakart.properties.
acquire
in interface KKLockMgrIf
lockName
- the name of the object to acquire the lock for. Use any String less than 32
characters in length.sleepMS
- number of milliseconds to sleep between attempts to acquire the lock_timeoutMS
- number of milliseconds to wait before forcibly acquiring the lockcom.konakart.app.KKException
- an unexpected KKException exceptionprotected boolean acquireLockSQL(java.lang.String lockname, java.sql.Date now) throws org.apache.torque.TorqueException
org.apache.torque.TorqueException
public void release(java.lang.String lockName) throws com.konakart.app.KKException
KKLockMgrIf
release
in interface KKLockMgrIf
lockName
- the name of the object to release the lock oncom.konakart.app.KKException
- an unexpected KKException exceptionprotected boolean releaseLockSQL(java.lang.String lockName) throws org.apache.torque.TorqueException
org.apache.torque.TorqueException
protected void initialise() throws com.konakart.app.KKException
com.konakart.app.KKException
public void refreshConfigs() throws com.konakart.app.KKException
KKLockMgrIf
refreshConfigs
in interface KKLockMgrIf
com.konakart.app.KKException
- an unexpected KKException exceptionpublic static boolean isLockingEnabled()
public static void setLockingEnabled(boolean lockingEnabled)
lockingEnabled
- the lockingEnabled to setpublic static int getSleepTimeMS()
public static void setSleepTimeMS(int sleepTimeMS)
sleepTimeMS
- the sleepTimeMS to setpublic static int getTimeoutMS()
public static void setTimeoutMS(int timeoutMS)
timeoutMS
- the timeoutMS to setpublic static boolean isInitialised()
public static void setInitialised(boolean initialised)
initialised
- the initialised to setpublic static java.lang.String getLockFailureRE()
public static void setLockFailureRE(java.lang.String lockFailureRE)
lockFailureRE
- the lockFailureRE to setpublic static java.lang.String getReleaseFailureRE()
public static void setReleaseFailureRE(java.lang.String releaseFailureRE)
releaseFailureRE
- the releaseFailureRE to setCopyright © 2018 DS Data Systems UK Ltd.