Class LockHandle

java.lang.Object
com.mckoi.database.LockHandle

public final class LockHandle extends Object
This represents a handle for a series of locks that a query has over the tables in a database. It is returned by the 'LockingMechanism' object after the 'lockTables' method is used.

Author:
Tobias Downer
  • Method Details

    • checkAccess

      public void checkAccess(DataTable table, int access_type)
      Blocks until access to the given DataTable object is safe. It blocks using either the read or read/write privs that it has been given. Note that this method is public and is a method that is intended to be used outside the locking mechanism. We also provide an 'access_type' field which is set to the type of access that is happening for this check. This is either Lock.READ or Lock.WRITE. NOTE: Any call to this method after the first call should be instantanious.
    • finalize

      public void finalize()
      On garbage collection, this will call 'unlockAll' just in case the program did not use the 'LockingMechanism.unlockTables' method in error. This should ensure the database does not deadlock. This method is a 'just in case' clause.
      Overrides:
      finalize in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object