@Component(value="cuba_LockManager") public class LockManager extends java.lang.Object implements LockManagerAPI, ClusterListener<LockInfo>
NAME| Constructor and Description |
|---|
LockManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
expireLocks()
Process locks expiring.
|
java.util.List<LockInfo> |
getCurrentLocks()
List of current locks
|
LockInfo |
getLockInfo(java.lang.String name,
java.lang.String id)
Get locking status for particular object
|
byte[] |
getState()
Get state of this cluster node to send it to other nodes.
|
LockInfo |
lock(Entity entity)
Try to lock an entity.
|
LockInfo |
lock(java.lang.String name,
java.lang.String id)
Try to lock an arbitrary object.
|
void |
receive(LockInfo message)
Receive a message from other cluster nodes.
|
void |
reloadConfiguration() |
void |
setClusterManager(ClusterManagerAPI clusterManager) |
void |
setState(byte[] state)
Set state of this cluster node receiving it from other active node.
|
void |
unlock(Entity entity)
Unlock an entity.
|
void |
unlock(java.lang.String name,
java.lang.String id)
Unlock an arbitrary object.
|
@Inject public void setClusterManager(ClusterManagerAPI clusterManager)
public LockInfo lock(java.lang.String name, java.lang.String id)
LockManagerAPIlock in interface LockManagerAPIname - locking object nameid - locking object IDLockNotSupported instance in case of locking is not configured for this object,LockInfo instance in case of this object is already locked by someone@Nullable public LockInfo lock(Entity entity)
LockManagerAPIlock in interface LockManagerAPIentity - entity instanceLockNotSupported instance in case of locking is not configured for this entity,LockInfo instance in case of this entity is already locked by someonepublic void unlock(java.lang.String name,
java.lang.String id)
LockManagerAPIunlock in interface LockManagerAPIname - locking object nameid - locking object IDpublic void unlock(Entity entity)
LockManagerAPIunlock in interface LockManagerAPIentity - entity instancepublic LockInfo getLockInfo(java.lang.String name, java.lang.String id)
LockManagerAPIgetLockInfo in interface LockManagerAPIname - locking object nameid - locking object IDLockNotSupported instance in case of locking is not configured for this object,LockInfo instance in case of this object is locked by someonepublic java.util.List<LockInfo> getCurrentLocks()
LockManagerAPIgetCurrentLocks in interface LockManagerAPIpublic void expireLocks()
LockManagerAPIexpireLocks in interface LockManagerAPIpublic void reloadConfiguration()
reloadConfiguration in interface LockManagerAPIpublic void receive(LockInfo message)
ClusterListenerreceive in interface ClusterListener<LockInfo>message - message instancepublic byte[] getState()
ClusterListenerThis method is invoked by clustering implementation when a new node joins the cluster and wants to receive the state from this active node.
getState in interface ClusterListener<LockInfo>public void setState(byte[] state)
ClusterListenerThis method is invoked by clustering implementation once when this node joins the cluster.
setState in interface ClusterListener<LockInfo>state - byte array containing the state