org.terracotta.collections
Class FinegrainedLockNoDso

java.lang.Object
  extended by org.terracotta.collections.FinegrainedLockNoDso
All Implemented Interfaces:
FinegrainedLock

public class FinegrainedLockNoDso
extends Object
implements FinegrainedLock


Constructor Summary
FinegrainedLockNoDso()
           
 
Method Summary
 boolean isHeldByCurrentThread()
          Indicates whether the current thread is holding a lock that corresponds to this granularity and default lock type.
 boolean isHeldByCurrentThread(LockType lockType)
          Indicates whether the current thread is holding a lock that corresponds to this granularity and specified lock type.
 void lock()
          Lock the underlying data structure for this lock's granularity using the default lock type.
 void lock(LockType lockType)
          Lock the underlying data structure for this lock's granularity with a specified lock type.
 boolean tryLock()
          Lock the underlying data structure for this lock's granularity using the default lock type only if the lock is not held by another thread at the time of invocation.
 boolean tryLock(LockType lockType)
          Lock the underlying data structure for this lock's granularity with a specified lock type only if the lock is not held by another thread at the time of invocation.
 boolean tryLock(LockType lockType, long timeout, TimeUnit unit)
          Lock the underlying data structure for this lock's granularity with a specified lock type only if the lock is not held by another thread within a given time.
 boolean tryLock(long timeout, TimeUnit unit)
          Lock the underlying data structure for this lock's granularity using the default lock type only if the lock is not held by another thread within a given time.
 void unlock()
          Unlocks the underlying data structure for this lock's granularity using the default lock type.
 void unlock(LockType lockType)
          Unlocks the underlying data structure for this lock's granularity using the specified lock type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FinegrainedLockNoDso

public FinegrainedLockNoDso()
Method Detail

lock

public void lock()
Description copied from interface: FinegrainedLock
Lock the underlying data structure for this lock's granularity using the default lock type.

Specified by:
lock in interface FinegrainedLock

lock

public void lock(LockType lockType)
Description copied from interface: FinegrainedLock
Lock the underlying data structure for this lock's granularity with a specified lock type.

Specified by:
lock in interface FinegrainedLock
Parameters:
lockType - the type of lock that needs to be locked

unlock

public void unlock()
Description copied from interface: FinegrainedLock
Unlocks the underlying data structure for this lock's granularity using the default lock type.

Specified by:
unlock in interface FinegrainedLock

unlock

public void unlock(LockType lockType)
Description copied from interface: FinegrainedLock
Unlocks the underlying data structure for this lock's granularity using the specified lock type.

Specified by:
unlock in interface FinegrainedLock
Parameters:
lockType - the type of lock that needs to be unlocked

tryLock

public boolean tryLock()
Description copied from interface: FinegrainedLock
Lock the underlying data structure for this lock's granularity using the default lock type only if the lock is not held by another thread at the time of invocation.

Specified by:
tryLock in interface FinegrainedLock
Returns:
true if the lock was successfully acquired; or {@code false) otherwise

tryLock

public boolean tryLock(LockType lockType)
Description copied from interface: FinegrainedLock
Lock the underlying data structure for this lock's granularity with a specified lock type only if the lock is not held by another thread at the time of invocation.

Specified by:
tryLock in interface FinegrainedLock
Parameters:
lockType - the type of lock that needs to be locked
Returns:
true if the lock was successfully acquired; or {@code false) otherwise

tryLock

public boolean tryLock(long timeout,
                       TimeUnit unit)
Description copied from interface: FinegrainedLock
Lock the underlying data structure for this lock's granularity using the default lock type only if the lock is not held by another thread within a given time.

Specified by:
tryLock in interface FinegrainedLock
Parameters:
timeout - the time to wait
unit - the time unit of the timeout argument
Returns:
true if the lock was successfully acquired; or {@code false) otherwise

tryLock

public boolean tryLock(LockType lockType,
                       long timeout,
                       TimeUnit unit)
Description copied from interface: FinegrainedLock
Lock the underlying data structure for this lock's granularity with a specified lock type only if the lock is not held by another thread within a given time.

Specified by:
tryLock in interface FinegrainedLock
Parameters:
lockType - the type of lock that needs to be locked
timeout - the time to wait
unit - the time unit of the timeout argument
Returns:
true if the lock was successfully acquired; or {@code false) otherwise

isHeldByCurrentThread

public boolean isHeldByCurrentThread()
Description copied from interface: FinegrainedLock
Indicates whether the current thread is holding a lock that corresponds to this granularity and default lock type.

Specified by:
isHeldByCurrentThread in interface FinegrainedLock
Returns:
true if the current thread is holding the lock; or false otherwise

isHeldByCurrentThread

public boolean isHeldByCurrentThread(LockType lockType)
Description copied from interface: FinegrainedLock
Indicates whether the current thread is holding a lock that corresponds to this granularity and specified lock type.

Specified by:
isHeldByCurrentThread in interface FinegrainedLock
Parameters:
lockType - the type of lock that needs to be checked
Returns:
true if the current thread is holding the lock; or false otherwise


Copyright © 2010 Terracotta, Inc.. All Rights Reserved.