|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.neo4j.kernel.impl.transaction.LockManager
public class LockManager
The LockManager can lock resources for reading or writing. By doing this one may achieve different transaction isolation levels. A resource can for now be any object (but null).
When acquiring a lock you have to release it. Failure to do so will result in the resource being blocked to all other transactions. Put all locks in a try - finally block.
Multiple locks on the same resource held by the same transaction requires the
transaction to invoke the release lock method multiple times. If a tx has
invoked getReadLock on the same resource x times in a row it
must invoke releaseReadLock x times to release all the locks.
LockManager just maps locks to resources and they do all the hard work together with a resource allocation graph.
| Constructor Summary | |
|---|---|
LockManager(TransactionManager tm)
|
|
| Method Summary | |
|---|---|
void |
dumpAllLocks()
Utility method for debugging. |
void |
dumpLocksOnResource(Object resource)
Utility method for debugging. |
void |
dumpRagStack()
Utility method for debugging. |
long |
getDetectedDeadlockCount()
|
void |
getReadLock(Object resource)
Tries to acquire read lock on resource for the current
transaction. |
void |
getWriteLock(Object resource)
Tries to acquire write lock on resource for the current
transaction. |
void |
releaseReadLock(Object resource,
Transaction tx)
Releases a read lock held by the current transaction on resource. |
void |
releaseWriteLock(Object resource,
Transaction tx)
Releases a read lock held by the current transaction on resource. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LockManager(TransactionManager tm)
| Method Detail |
|---|
public long getDetectedDeadlockCount()
public void getReadLock(Object resource)
throws DeadlockDetectedException,
IllegalResourceException
resource for the current
transaction. If read lock can't be acquired the transaction will wait for
the lransaction until it can acquire it. If waiting leads to dead lock a
DeadlockDetectedException will be thrown.
resource - The resource
DeadlockDetectedException - If a deadlock is detected
IllegalResourceException
public void getWriteLock(Object resource)
throws DeadlockDetectedException,
IllegalResourceException
resource for the current
transaction. If write lock can't be acquired the transaction will wait
for the lock until it can acquire it. If waiting leads to dead lock a
DeadlockDetectedException will be thrown.
resource - The resource
DeadlockDetectedException - If a deadlock is detected
IllegalResourceException
public void releaseReadLock(Object resource,
Transaction tx)
throws LockNotFoundException,
IllegalResourceException
resource.
If current transaction don't have read lock a
LockNotFoundException will be thrown.
resource - The resource
IllegalResourceException
LockNotFoundException
public void releaseWriteLock(Object resource,
Transaction tx)
throws LockNotFoundException,
IllegalResourceException
resource.
If current transaction don't have read lock a
LockNotFoundException will be thrown.
resource - The resource
IllegalResourceException
LockNotFoundExceptionpublic void dumpLocksOnResource(Object resource)
resource - public void dumpRagStack()
public void dumpAllLocks()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||