public class LockManager extends Object implements ILockManagerSPI
Constructor and Description |
---|
LockManager() |
Modifier and Type | Method and Description |
---|---|
void |
forceSingleUnlock(String id)
Force the unlock of a single lock with the specified identifier (database id).
|
void |
forceUnlock(String resourceId)
Forces the unlock of the specified lock resource, independently of the
current owner.
|
Lock |
getLock(String resourceId)
Deprecated.
|
Lock |
getReadLock(String resourceId)
Returns a non-exclusive read lock object for the specified resource.
|
Collection<String> |
getRecentlyLock(long lastMilliseconds)
Return write locks for the last millisenconds
|
Lock |
getWriteLock(String resourceId)
Returns an exclusive write lock object for the specified resource.
|
void |
unlockExpiredLocks()
Deletes all the locks that have expired.
|
@Deprecated public Lock getLock(String resourceId)
ILockManager
See lumis.portal.lock
for details about the consequences of
the lock scope being cluster-wide.
The lock implementation returned does not support conditions. The
Lock.newCondition()
method throws UnsupportedOperationException
.
If this method is called multiple times with the same resourceId value,
the lock objects returned use a common synchronizing resource. This way,
calling Lock.lock()
on any of these lock objects will generate
a lock in the same resource (and these locks will block each other).
But a Lock.unlock()
must still be executed in
the same Lock
instance on which the lock was acquired, since
it is considered the owner of that lock.
getLock
in interface ILockManager
resourceId
- the identifier of the resource the lock refers to. It
is recommended to name the identifier using Java class name style
(e.g. com.company.module.etc.MyResource) to prevent naming conflicts on
different implementations.lumis.portal.lock
public Lock getReadLock(String resourceId)
ILockManager
See lumis.portal.lock
for details about the consequences of the lock scope being cluster-wide.
The lock implementation returned does not support conditions. The Lock.newCondition()
method throws
UnsupportedOperationException
.
This kind of lock requires that there's no write lock holding the lock of the same resource. In the other hand, multiple read locks may be holding the lock for the same resource at the same time.
This lock is indicated when some resource must be read but it will not be changed. This way, multiple processes that must read the same resource will not block each other.
getReadLock
in interface ILockManager
resourceId
- the identifier of the resource the lock refers to. It is recommended to name the identifier using Java
class name style (e.g. com.company.module.etc.MyResource) to prevent naming conflicts on different
implementations.lumis.portal.lock
public Lock getWriteLock(String resourceId)
ILockManager
See lumis.portal.lock
for details about the consequences of the lock scope being cluster-wide.
The lock implementation returned does not support conditions. The Lock.newCondition()
method throws
UnsupportedOperationException
.
This kind of lock requires that there's no other lock holding the lock of the same resource. Once this lock has been locked, no other lock will be able to access the specified resource until this lock has been unlocked.
This lock is indicated when some resource must be changed. This way, the owner of this lock can change the resource exclusively, avoiding other processes to read or change the specified resource erroneously.
getWriteLock
in interface ILockManager
resourceId
- the identifier of the resource the lock refers to. It is recommended to name the identifier using Java
class name style (e.g. com.company.module.etc.MyResource) to prevent naming conflicts on different
implementations.lumis.portal.lock
public void unlockExpiredLocks() throws PortalException
ILockManager
unlockExpiredLocks
in interface ILockManager
PortalException
public void forceUnlock(String resourceId) throws PortalException
resourceId
- the lock resource identifier.PortalException
public void forceSingleUnlock(String id) throws PortalException
id
- the lock identifier.PortalException
public Collection<String> getRecentlyLock(long lastMilliseconds) throws PortalException
ILockManagerSPI
getRecentlyLock
in interface ILockManagerSPI
PortalException
LumisXP 12.0.0.190809 - Copyright © 2006–2019 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.