public class DatabaseLockManager extends AbstractLockManager
create table ECELocks ( lockID INTEGER AUTO_INCREMENT, identifier VARCHAR(100) not null, resourceLockHandle VARCHAR(100) null, server VARCHAR(100) not null, lockedBy VARCHAR(100) null, expires DATETIME null, acquired DATETIME not null, ping DATETIME not null, constraint PK_ECELocks primary key(lockID), constraint ECELocks_ident_uniq unique(identifier) )
identifier has the form type:id. For example article:1234 or section:123. identifier is unique so if two instances of DatabaseLockManager tries to acquire the lock at the same time, just one of them will get the lock.
server is the name of the server the DatabaseLockManager is running on. server is set to the value of the system property escenic.server.
lockedBy is not used yet. The intention is to use this for the user which has the lock.
expires is not used yet. The intended use is to set a time when the lock expires and others are free to take the lock.
acquired is the time when the lock was granted.
ping is a time stamp refreshed by the DatabaseLockManagerPingService at a certain interval. Locks where the ping time stamp is older than x minutes will be removed. This is done to remove locks acquired by servers no longer running.
GenericService.StartCommand, GenericService.StopCommand
Modifier and Type | Field and Description |
---|---|
protected neo.xredsys.config.ServerConfig |
mServerConfig
Deprecated.
|
mContentManager, mEventManager, mObjectLoader, mResourceLockManager
CLASS_VERSION
mLogger, state
Constructor and Description |
---|
DatabaseLockManager()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected IOTransaction |
createTransaction(IOObject pObject)
Deprecated.
Creates a transaction object from the given IOObject.
|
protected boolean |
deleteLockImpl(IOHashKey pHashKey,
boolean pLocal)
Deprecated.
|
protected void |
deleteOldLocks()
Deprecated.
|
protected LockInfo |
getLockInfoImpl(IOHashKey pKey)
Deprecated.
|
long |
getStaleLockTimeMillis()
Deprecated.
|
protected IOTransaction |
lockImpl(IOObject pObject,
IOLockKeeper pLockKeeper,
List<String> pLockHandles)
Deprecated.
|
protected IOTransaction |
lockImpl(IOObject pObject,
IOLockKeeper pLockKeeper,
String pHandle,
List<String> pLockHandles)
Deprecated.
|
protected String |
obtainResourceLockImpl(URI pURI,
IOLockKeeper pLockKeeper,
List<String> pLockHandles,
String pMessage)
Deprecated.
|
protected void |
refreshLockImpl(IOTransaction pTransaction,
String pHandle)
Deprecated.
|
void |
setStaleLockTimeMillis(long pTime)
Deprecated.
|
protected void |
startService()
Deprecated.
Is called by
AbstractNurseryService.doStartService() when the NurseryService is being started. |
protected void |
updateLockPing()
Deprecated.
|
addActiveLock, breakAndLock, breakAndLock, breakLock, breakLock, checkObjectForCreate, checkObjectForDelete, checkObjectForUpdate, getActiveTransaction, getContentManager, getEventManager, getLockInfoFromIdentifier, getLockInfoFromIdentifier, getLockKeeper, getLockKeeper, getObjectLoader, getResourceLockManager, handleEvent, isActive, isLocked, isLocked, isNewObject, lock, lock, lock, refreshLock, release, releaseLock, removeActiveLock, setContentManager, setEventManager, setObjectLoader, setResourceLockManager, stopService, triggerEvent, triggerLockBrokenEvent, triggerLockBrokenEvent, triggerLockedEvent, triggerLockTakenEvent, triggerLockTakenEvent, triggerUnlockedEvent
doStartService, doStopService, stopIdleService
assertServiceRunning, getServiceDescription, getServiceMessage, getServiceState, isServiceEnabled, isServiceFailed, isServiceIdle, isServiceRunning, isServiceShutdownFailed, isServiceStopped, setServiceDescription, setServiceEnabled, start, stop, validateIsTrue, validateNotNull
public void setStaleLockTimeMillis(long pTime)
public long getStaleLockTimeMillis()
protected void startService() throws Exception
AbstractNurseryService
Is called by AbstractNurseryService.doStartService()
when the NurseryService
is being started. Exceptions thrown by this
method are logged by AbstractNurseryService.doStartService()
.
Subclasses must implement this method to bootstrap the service.
startService
in class AbstractLockManager
Exception
- when something goes wrong during startup. GenericService.isServiceRunning()
will return false
and GenericService.isServiceFailed()
will return true
.IllegalArgumentException
- when the configuration of the service
is invalid. GenericService.isServiceRunning()
will return false
and GenericService.isServiceFailed()
will return true
.IllegalStateException
- when this service is in the wrong state for startup. Used to signal to AbstractNurseryService.doStartService()
that it is OK to try to starting
this service
later. GenericService.isServiceRunning()
returns false
and GenericService.isServiceIdle()
returns true
.AbstractNurseryService.doStartService()
protected void updateLockPing() throws SQLException
SQLException
protected void deleteOldLocks() throws IllegalOperationException
IllegalOperationException
protected boolean deleteLockImpl(IOHashKey pHashKey, boolean pLocal)
deleteLockImpl
in class AbstractLockManager
protected LockInfo getLockInfoImpl(IOHashKey pKey)
getLockInfoImpl
in class AbstractLockManager
protected IOTransaction lockImpl(IOObject pObject, IOLockKeeper pLockKeeper, List<String> pLockHandles) throws IllegalArgumentException, IllegalOperationException
lockImpl
in class AbstractLockManager
IllegalArgumentException
IllegalOperationException
protected final IOTransaction lockImpl(IOObject pObject, IOLockKeeper pLockKeeper, String pHandle, List<String> pLockHandles) throws IllegalArgumentException, IllegalOperationException
lockImpl
in class AbstractLockManager
IllegalArgumentException
IllegalOperationException
protected String obtainResourceLockImpl(URI pURI, IOLockKeeper pLockKeeper, List<String> pLockHandles, String pMessage) throws AlreadyLockedException
obtainResourceLockImpl
in class AbstractLockManager
AlreadyLockedException
protected IOTransaction createTransaction(IOObject pObject) throws IllegalOperationException
AbstractLockManager
createTransaction
in class AbstractLockManager
pObject
- the objectIllegalOperationException
- if creating the transaction failsprotected final void refreshLockImpl(IOTransaction pTransaction, String pHandle)
refreshLockImpl
in class AbstractLockManager
© 1998- 2021 Escenic AS