org.terracotta.toolkit.concurrent.locks
Interface ToolkitLock

All Superinterfaces:
Lock, ToolkitObject

public interface ToolkitLock
extends Lock, ToolkitObject

Provides primitive lock operations for the given ToolkitLockType that was used to create an instance of this lock. Multiple instances having the same name behave as same lock.


Method Summary
 Condition getCondition()
          Returns the Condition associated with the Lock.
 ToolkitLockType getLockType()
          Return the ToolkitLockType for this Lock.
 boolean isHeldByCurrentThread()
          Indicates whether the current thread is holding this lock for getLockType().
 Condition newCondition()
          Always throws UnsupportedOperationException.
 
Methods inherited from interface java.util.concurrent.locks.Lock
lock, lockInterruptibly, tryLock, tryLock, unlock
 
Methods inherited from interface org.terracotta.toolkit.object.ToolkitObject
getName
 

Method Detail

newCondition

Condition newCondition()
                       throws UnsupportedOperationException
Always throws UnsupportedOperationException. ToolkitLock supports one condition per lock which can be obtained by using method getCondition()

Specified by:
newCondition in interface Lock
Returns:
does not return anything
Throws:
UnsupportedOperationException - always throws this exception

getCondition

Condition getCondition()
Returns the Condition associated with the Lock. This is optional operation and some implementation may throw UnsupportedOperationException. e.g. for read level locks

Returns:
condition associated with the lock

getLockType

ToolkitLockType getLockType()
Return the ToolkitLockType for this Lock.

Returns:
the lock type of this lock

isHeldByCurrentThread

boolean isHeldByCurrentThread()
Indicates whether the current thread is holding this lock for getLockType().

Returns:
returns true if current thread is holding this lock for getLockType()


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