|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.sasl.distributed.lock.impl.DefaultLockSession
public class DefaultLockSession
A non thread-safe lock session implementation with the following behavior:
| Nested Class Summary | |
|---|---|
protected class |
DefaultLockSession.LockSequence
Lock sequence which could have nested lock sequences. |
protected class |
DefaultLockSession.MutexDecorator
|
| Constructor Summary | |
|---|---|
DefaultLockSession(LockSessionFactory lockSessionFactory,
Thread ownerThread,
boolean strictLockSequenceMode)
|
|
| Method Summary | |
|---|---|
ILockSequence |
beginLockSequence(String name)
Starts a new lock sequence, which is owned by the session. |
void |
clear()
Releases all locks that this lock container holds. |
protected void |
doRelease()
Releases the lock session without doing any thread access check. |
ILockSequence |
getCurrentLockSequence()
Returns the current active lock sequence of the session. |
LockSessionFactory |
getLockSessionFactory()
Returns the lock session factory over which the session was created. |
String |
getName()
Returns a name of the lock container, for example "lock-transaction-X". |
boolean |
isActive()
Returns true if this lock container is active which means it was not yet released via ILockContainer.release(). |
boolean |
isInvalid()
Returns true if the session is invalid, possibly because of an irreparable occured error like a DeadLockException. |
boolean |
isLocalLockHeldByASequence(Object lockKey)
Returns true, if for the given lockKey a local lock is held by one lock sequence. |
boolean |
isLockKeyOwnedByASequence(Object lockKey)
Returns true, if for the given lockKey a mutex is acquired by a lock sequence. |
void |
release()
Releases all resources associated with this lock container. |
boolean |
supportsNestedLockSequences()
Returns true, if the session supports nested sequences, false else. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultLockSession(LockSessionFactory lockSessionFactory,
Thread ownerThread,
boolean strictLockSequenceMode)
throws IllegalArgumentException
lockSessionFactory - non nullownerThread - null or non null thread over which the session was created. If
non null thread check will be enabled.strictLockSequenceMode - whether strict lock sequence mode should be enabled or not.
IllegalArgumentException - if parameter lockSessionFactory is null.| Method Detail |
|---|
public LockSessionFactory getLockSessionFactory()
ILockSession
getLockSessionFactory in interface ILockSessionILockSession.getLockSessionFactory()
public ILockSequence beginLockSequence(String name)
throws LockOperationException
ILockSession
beginLockSequence in interface ILockSessionname - null or non null
LockOperationException - in any exception case.ILockSession.beginLockSequence(java.lang.String)
public ILockSequence getCurrentLockSequence()
throws LockOperationException
ILockSession
getCurrentLockSequence in interface ILockSessionLockOperationException - in any exception case.ILockSession.getCurrentLockSequence()
public void clear()
throws LockOperationException
ILockContainerILockContainer.release().
The container stays active after the operation.
clear in interface ILockContainerLockOperationException - if an exception occurs during releasing locks and nested
containers.ILockContainer.clear()
public void release()
throws LockOperationException
ILockContainer
release in interface ILockContainerLockOperationExceptionILockContainer.release()
protected void doRelease()
throws LockOperationException
LockOperationException - on any error case.public boolean supportsNestedLockSequences()
ILockSession
supportsNestedLockSequences in interface ILockSessionILockSession.supportsNestedLockSequences()
public boolean isLocalLockHeldByASequence(Object lockKey)
throws IllegalArgumentException
ILockSession
isLocalLockHeldByASequence in interface ILockSessionlockKey - non null.
IllegalArgumentExceptionILockSession.isLocalLockHeldByASequence(java.lang.Object)
public boolean isLockKeyOwnedByASequence(Object lockKey)
throws IllegalArgumentException
ILockSession
isLockKeyOwnedByASequence in interface ILockSessionlockKey - non null
IllegalArgumentExceptionILockSession.isLockKeyOwnedByASequence(java.lang.Object)public String getName()
ILockContainer
getName in interface ILockContainerILockContainer.getName()public boolean isActive()
ILockContainerILockContainer.release(). False else. An inactive lock container
should be disconnected from all types of lock operations.
isActive in interface ILockContainerILockContainer.isActive()public boolean isInvalid()
ILockSessionDeadLockException.
An invalid session can only be made valid again, by clearing it.
isInvalid in interface ILockSessionnet.sf.sasl.distributed.lock.ILockContainer#isInvalid()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||