arlut.csd.ganymede
Class DBDeletionManager

java.lang.Object
  |
  +--arlut.csd.ganymede.DBDeletionManager

public class DBDeletionManager
extends java.lang.Object

The DBDeletionManager class is used to handle deletion locking in the Ganymede DBStore.


Field Summary
private static java.util.Hashtable invids
          A hashtable mapping Invid objects to a Vector of DBSession objects.
private static java.util.Hashtable sessions
          A hashtable mapping DBSession objects to a Vector of Invid objects.
 
Constructor Summary
DBDeletionManager()
           
 
Method Summary
static boolean addSessionInvids(DBSession session, java.util.Vector invidList)
          This method deletion-locks a vector of invids, returning false without changes if the deletion-locks could not all be performed.
static boolean deleteLockObject(DBObject obj, DBSession session)
          This method is used by the Invid binding logic to attempt to block an object from being deleted.
static java.util.Vector getSessionCheckpoint(DBSession session)
          This method returns a snapshot of what Invids are locked by a given session at the time the method is called.
static void releaseSession(DBSession session)
          When a DBSession releases or commits a transaction, this method is called to clear any deletion locks asserted by it.
static void revertSessionCheckpoint(DBSession session, java.util.Vector invidList)
          This method rolls back the invids delete-locked by a session to an earlier state.
static boolean setDeleteStatus(DBEditObject obj, DBSession session)
          This method is used by the DBSession deleteDBObject() method to safely convert a DBEditObject's status to a deletion state.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

sessions

private static java.util.Hashtable sessions

A hashtable mapping DBSession objects to a Vector of Invid objects.

DBSession will appear as keys in this hash when those sessions have locked Invids in the database against deletion. The Vector of Invids mapped from the DBSession is the list of Invids that that DBSession has locked.


invids

private static java.util.Hashtable invids

A hashtable mapping Invid objects to a Vector of DBSession objects.

Invids will appear as keys in this hash when the DBObjects corresponding to those Invids have been delete locked by DBSessions in the server. The Vector of DBSession objects is the list of DBSessions that have locked the Invid.

Constructor Detail

DBDeletionManager

public DBDeletionManager()
Method Detail

deleteLockObject

public static boolean deleteLockObject(DBObject obj,
                                       DBSession session)

This method is used by the Invid binding logic to attempt to block an object from being deleted. If this method returns true, the object will be forbidden from being deleted until such time as the DBSession that asserted the lock clears it.


setDeleteStatus

public static boolean setDeleteStatus(DBEditObject obj,
                                      DBSession session)

This method is used by the DBSession deleteDBObject() method to safely convert a DBEditObject's status to a deletion state. This method returns true if the object was able to be converted to a deletion state, or false if the object has been deletion locked by another DBSession.


releaseSession

public static void releaseSession(DBSession session)

When a DBSession releases or commits a transaction, this method is called to clear any deletion locks asserted by it.


addSessionInvids

public static boolean addSessionInvids(DBSession session,
                                       java.util.Vector invidList)

This method deletion-locks a vector of invids, returning false without changes if the deletion-locks could not all be performed.


getSessionCheckpoint

public static java.util.Vector getSessionCheckpoint(DBSession session)

This method returns a snapshot of what Invids are locked by a given session at the time the method is called. It is used by the DBEditSet checkpoint code to allow a transaction to checkpoint the objects that the transaction had delete-locked at a moment in time. With revertSessionCheckpoint(), below, a transaction can provisionally carry out some object linkages which delete-locks objects, then undo those additional locks if the transaction is rolled back.


revertSessionCheckpoint

public static void revertSessionCheckpoint(DBSession session,
                                           java.util.Vector invidList)

This method rolls back the invids delete-locked by a session to an earlier state. revertSessionCheckpoint() cannot cause more invids to be delete-locked.. the only effect it can have is to undelete-lock invids that were provisionally delete-locked by session between a checkpoint and rollback.