org.apache.derby.impl.services.locks
Class LockSet

java.lang.Object
  extended byjava.util.Dictionary
      extended byjava.util.Hashtable
          extended byorg.apache.derby.impl.services.locks.LockSet
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public final class LockSet
extends java.util.Hashtable

A LockSet is a complete lock table. A lock table is a hash table keyed by a Lockable and with a LockControl as the data element.

A LockControl contains information about the locks held on a Lockable.
MT - Mutable - Container Object : Thread Safe
The Hashtable we extend is synchronized on this, all addition, searching of the hashtable is performed using java synchroization(this).
The class creates ActiveLock and LockControl objects. LockControl objects are never passed out of this class, All the methods of LockControl are called while being synchronized on this, thus providing the single threading that LockControl required. Methods of Lockables are only called by this class or LockControl, and always while being synchronized on this, thus providing the single threading that Lockable requires.

See Also:
LockControl, Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.util.Hashtable
 
Field Summary
protected  int blockCount
           
protected  int deadlockTimeout
          Timeout for deadlocks, in ms.
private  boolean deadlockTrace
           
private  SinglePool factory
           
private  java.util.Hashtable lockTraces
           
protected  int waitTimeout
           
 
Fields inherited from class java.util.Hashtable
 
Constructor Summary
protected LockSet(SinglePool factory)
           
 
Method Summary
(package private)  boolean anyoneBlocked()
           
 Control getControl(Lockable ref)
           
 Lock lockObject(java.lang.Object compatabilitySpace, Lockable ref, java.lang.Object qualifier, int timeout, Latch latch)
          Lock an object within a specific compatibility space.
(package private)  void oneLessWaiter()
           
(package private)  void oneMoreWaiter()
           
(package private)  void setDeadlockTrace(boolean val)
           
(package private)  LockSet shallowClone()
           
 java.lang.String toDebugString()
           
(package private)  void unlock(Latch item, int unlockCount)
          Unlock an object, previously locked by lockObject().
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

factory

private final SinglePool factory

deadlockTimeout

protected int deadlockTimeout
Timeout for deadlocks, in ms.
MT - immutable


waitTimeout

protected int waitTimeout

deadlockTrace

private boolean deadlockTrace

lockTraces

private java.util.Hashtable lockTraces

blockCount

protected int blockCount
Constructor Detail

LockSet

protected LockSet(SinglePool factory)
Method Detail

lockObject

public Lock lockObject(java.lang.Object compatabilitySpace,
                       Lockable ref,
                       java.lang.Object qualifier,
                       int timeout,
                       Latch latch)
                throws StandardException
Lock an object within a specific compatibility space.

Parameters:
compatabilitySpace - Compatibility space.
ref - Lockable reference.
qualifier - Qualifier.
timeout - Timeout in milli-seconds
Returns:
Object that represents the lock.
Throws:
StandardException - Standard Cloudscape policy.

unlock

void unlock(Latch item,
            int unlockCount)
Unlock an object, previously locked by lockObject(). If unlockCOunt is not zero then the lock will be unlocked that many times, otherwise the unlock count is taken from item.


setDeadlockTrace

void setDeadlockTrace(boolean val)

toDebugString

public java.lang.String toDebugString()

shallowClone

LockSet shallowClone()

oneMoreWaiter

void oneMoreWaiter()

oneLessWaiter

void oneLessWaiter()

anyoneBlocked

boolean anyoneBlocked()

getControl

public final Control getControl(Lockable ref)

Built on Mon 2007-06-04 09:58:47+0400, from revision ???

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.