net.sf.sasl.distributed.lock.impl
Class DefaultLockSession.MutexDecorator

java.lang.Object
  extended by net.sf.sasl.distributed.lock.impl.DefaultLockSession.MutexDecorator
All Implemented Interfaces:
Lock, IMutex
Enclosing class:
DefaultLockSession

protected class DefaultLockSession.MutexDecorator
extends Object
implements IMutex

Since:
0.0.1 (sasl-distributed-lock-library)

Constructor Summary
DefaultLockSession.MutexDecorator(IMutex lock, DefaultLockSession.LockSequence ownerSequence)
           
 
Method Summary
 Object getLockKey()
          Returns the lock key to which this mutex belongs.
protected  boolean isLocalLocked()
          Returns true if the mutex was locked over the decorator in the past, false else.
 void lock()
           
 void lockInterruptibly()
           
 Condition newCondition()
           
protected  void release()
          Releases the lock, if a locked was acquired over the session in the past and the session is not invalid.
 boolean tryLock()
           
 boolean tryLock(long time, TimeUnit unit)
           
 void unlock()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLockSession.MutexDecorator

public DefaultLockSession.MutexDecorator(IMutex lock,
                                         DefaultLockSession.LockSequence ownerSequence)
Parameters:
lock - non null
Since:
0.0.1 (sasl-distributed-lock-library)
Method Detail

getLockKey

public Object getLockKey()
Description copied from interface: IMutex
Returns the lock key to which this mutex belongs.

Specified by:
getLockKey in interface IMutex
Returns:
null or non null
Since:
0.0.1 (sasl-distributed-lock-library)
See Also:
IMutex.getLockKey()

lock

public void lock()
Specified by:
lock in interface Lock
Since:
0.0.1 (sasl-distributed-lock-library)
See Also:
Lock.lock()

lockInterruptibly

public void lockInterruptibly()
                       throws InterruptedException
Specified by:
lockInterruptibly in interface Lock
Throws:
InterruptedException
Since:
0.0.1 (sasl-distributed-lock-library)
See Also:
Lock.lockInterruptibly()

newCondition

public Condition newCondition()
Specified by:
newCondition in interface Lock
Since:
0.0.1 (sasl-distributed-lock-library)
See Also:
Lock.newCondition()

tryLock

public boolean tryLock()
Specified by:
tryLock in interface Lock
Since:
0.0.1 (sasl-distributed-lock-library)
See Also:
Lock.tryLock()

tryLock

public boolean tryLock(long time,
                       TimeUnit unit)
                throws InterruptedException
Specified by:
tryLock in interface Lock
Throws:
InterruptedException
Since:
0.0.1 (sasl-distributed-lock-library)
See Also:
Lock.tryLock(long, java.util.concurrent.TimeUnit)

unlock

public void unlock()
Specified by:
unlock in interface Lock
Since:
0.0.1 (sasl-distributed-lock-library)
See Also:
Lock.unlock()

isLocalLocked

protected boolean isLocalLocked()
Returns true if the mutex was locked over the decorator in the past, false else.

Returns:
true or false.
Since:
0.0.1 (sasl-distributed-lock-library)

release

protected void release()
Releases the lock, if a locked was acquired over the session in the past and the session is not invalid.

Since:
0.0.1 (sasl-distributed-lock-library)


Copyright © 2010. All Rights Reserved.