org.apache.derby.diag
Class LockTable

java.lang.Object
  extended byorg.apache.derby.vti.VTITemplate
      extended byorg.apache.derby.diag.LockTable
All Implemented Interfaces:
java.sql.ResultSet, VTICosting

public class LockTable
extends VTITemplate
implements VTICosting

LockTable is a virtual table that shows all locks currently held in the database. This virtual table can be invoked by calling it directly

 select * from new org.apache.derby.diag.LockTable() t; 
or through the system alias LOCKTABLE
 select * from new LOCKTABLE() t; 

The LockTable virtual table takes a snap shot of the lock table while the system is in flux, so it is possible that some locks may be in transition state while the snap shot is taken. We choose to do this rather then impose extranous timing restrictions so that the use of this tool will not alter the normal timing and flow of execution in the application.

The LockTable virtual table has the following columns:


Field Summary
static int ALL
          return all locks and latches
private static ResultColumnDescriptor[] columnInfo
           
private  java.util.Hashtable currentRow
           
private  int flag
           
private  boolean initialized
           
static int LATCH
          return only latches
private  LanguageConnectionFactory lcf
           
private  java.util.Enumeration lockTable
           
private static java.sql.ResultSetMetaData metadata
           
private  TableNameInfo tabInfo
           
static int TABLE_AND_ROWLOCK
          return only table and row locks
private  TransactionController tc
           
private  boolean wasNull
           
 
Fields inherited from interface org.apache.derby.vti.VTICosting
defaultEstimatedCost, defaultEstimatedRowCount
 
Fields inherited from interface java.sql.ResultSet
CLOSE_CURSORS_AT_COMMIT, CONCUR_READ_ONLY, CONCUR_UPDATABLE, FETCH_FORWARD, FETCH_REVERSE, FETCH_UNKNOWN, HOLD_CURSORS_OVER_COMMIT, TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE
 
Constructor Summary
LockTable()
          The normal way of instantiating a LockTable, equivalent to LockTable(org.apache.derby.diag.LockTable->TABLE_AND_ROWLOCK).
LockTable(int flag)
          This call is intrusive and should only be used under the supervision of technical support.
 
Method Summary
 void close()
           
private  java.util.Hashtable dumpLock(Latch lock)
          Convert the lock information into a hashtable.
 double getEstimatedCostPerInstantiation(VTIEnvironment vtiEnvironment)
          Get the estimated cost for a single instantiation of a VTI.
 double getEstimatedRowCount(VTIEnvironment vtiEnvironment)
          Get the estimated row count for a single scan of a VTI.
 java.sql.ResultSetMetaData getMetaData()
           
 java.lang.String getString(int columnNumber)
          All columns in TransactionTable VTI are of String type.
 boolean next()
           
 boolean supportsMultipleInstantiations(VTIEnvironment vtiEnvironment)
          Find out if the ResultSet of the VTI can be instantiated multiple times.
 boolean wasNull()
           
 
Methods inherited from class org.apache.derby.vti.VTITemplate
absolute, afterLast, beforeFirst, cancelRowUpdates, clearWarnings, deleteRow, findColumn, first, getArray, getArray, getAsciiStream, getAsciiStream, getBigDecimal, getBigDecimal, getBigDecimal, getBigDecimal, getBinaryStream, getBinaryStream, getBlob, getBlob, getBoolean, getBoolean, getByte, getByte, getBytes, getBytes, getCharacterStream, getCharacterStream, getClob, getClob, getConcurrency, getCursorName, getDate, getDate, getDate, getDate, getDouble, getDouble, getFetchDirection, getFetchSize, getFloat, getFloat, getInt, getInt, getLong, getLong, getObject, getObject, getObject, getObject, getRef, getRef, getRow, getShort, getShort, getStatement, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getType, getUnicodeStream, getUnicodeStream, getURL, getURL, getWarnings, insertRow, isAfterLast, isBeforeFirst, isFirst, isLast, last, moveToCurrentRow, moveToInsertRow, previous, refreshRow, relative, rowDeleted, rowInserted, rowUpdated, setFetchDirection, setFetchSize, updateArray, updateArray, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateRef, updateRef, updateRow, updateShort, updateShort, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestamp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LATCH

public static final int LATCH
return only latches

See Also:
Constant Field Values

TABLE_AND_ROWLOCK

public static final int TABLE_AND_ROWLOCK
return only table and row locks

See Also:
Constant Field Values

ALL

public static final int ALL
return all locks and latches

See Also:
Constant Field Values

tc

private TransactionController tc

lcf

private LanguageConnectionFactory lcf

currentRow

private java.util.Hashtable currentRow

lockTable

private java.util.Enumeration lockTable

wasNull

private boolean wasNull

initialized

private boolean initialized

flag

private final int flag

tabInfo

private TableNameInfo tabInfo

columnInfo

private static final ResultColumnDescriptor[] columnInfo

metadata

private static final java.sql.ResultSetMetaData metadata
Constructor Detail

LockTable

public LockTable()
The normal way of instantiating a LockTable, equivalent to LockTable(org.apache.derby.diag.LockTable->TABLE_AND_ROWLOCK). Only shows row and table lock and not latches. Latches are generally held for very short duration and are not of interest to Cloudscape users. Only under abnormal circumstances will one be interested in looking at latches.


LockTable

public LockTable(int flag)
This call is intrusive and should only be used under the supervision of technical support. Create an instance of the lock table which has transient latches as well as locks.

Method Detail

getMetaData

public java.sql.ResultSetMetaData getMetaData()
Specified by:
getMetaData in interface java.sql.ResultSet
See Also:
ResultSet.getMetaData()

next

public boolean next()
             throws java.sql.SQLException
Specified by:
next in interface java.sql.ResultSet
Throws:
java.sql.SQLException - if no transaction context can be found, or other Cloudscape internal errors are encountered.
See Also:
ResultSet.next()

close

public void close()
Specified by:
close in interface java.sql.ResultSet
See Also:
ResultSet.close()

getString

public java.lang.String getString(int columnNumber)
All columns in TransactionTable VTI are of String type.

Specified by:
getString in interface java.sql.ResultSet
Overrides:
getString in class VTITemplate
See Also:
ResultSet.getString(int)

wasNull

public boolean wasNull()
Specified by:
wasNull in interface java.sql.ResultSet
Overrides:
wasNull in class VTITemplate
See Also:
ResultSet.wasNull()

getEstimatedRowCount

public double getEstimatedRowCount(VTIEnvironment vtiEnvironment)
Description copied from interface: VTICosting
Get the estimated row count for a single scan of a VTI.

Specified by:
getEstimatedRowCount in interface VTICosting
Parameters:
vtiEnvironment - The VTIEnvironment.
Returns:
The estimated row count for a single scan of a VTI.
See Also:
VTICosting.getEstimatedRowCount(org.apache.derby.vti.VTIEnvironment)

getEstimatedCostPerInstantiation

public double getEstimatedCostPerInstantiation(VTIEnvironment vtiEnvironment)
Description copied from interface: VTICosting
Get the estimated cost for a single instantiation of a VTI.

Specified by:
getEstimatedCostPerInstantiation in interface VTICosting
Parameters:
vtiEnvironment - The VTIEnvironment.
Returns:
The estimated cost for a single instantiation of a VTI.
See Also:
VTICosting.getEstimatedCostPerInstantiation(org.apache.derby.vti.VTIEnvironment)

supportsMultipleInstantiations

public boolean supportsMultipleInstantiations(VTIEnvironment vtiEnvironment)
Description copied from interface: VTICosting
Find out if the ResultSet of the VTI can be instantiated multiple times.

Specified by:
supportsMultipleInstantiations in interface VTICosting
Parameters:
vtiEnvironment - The VTIEnvironment.
Returns:
false
See Also:
VTICosting.supportsMultipleInstantiations(org.apache.derby.vti.VTIEnvironment)

dumpLock

private java.util.Hashtable dumpLock(Latch lock)
                              throws StandardException
Convert the lock information into a hashtable.

Throws:
StandardException


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