db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r504462 - in /db/derby/code/trunk/java: engine/org/apache/derby/iapi/services/locks/LockFactory.java engine/org/apache/derby/impl/services/locks/SinglePool.java testing/org/apache/derbyTesting/unitTests/services/T_LockFactory.java
Date Wed, 07 Feb 2007 08:45:56 GMT
Author: kahatlen
Date: Wed Feb  7 00:45:55 2007
New Revision: 504462

URL: http://svn.apache.org/viewvc?view=rev&rev=504462
Log:
DERBY-2107: Move page latching out of the lock manager

Removed the latch methods from the lock manager and the unit tests.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/locks/LockFactory.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/SinglePool.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/services/T_LockFactory.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/locks/LockFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/locks/LockFactory.java?view=diff&rev=504462&r1=504461&r2=504462
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/locks/LockFactory.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/locks/LockFactory.java
Wed Feb  7 00:45:55 2007
@@ -78,39 +78,6 @@
 		throws StandardException;
 
 	/**
-		Lock an object within a compatability space
-		and associate the lock with a group object,
-		waits forever the object to become unlocked.
-		<P>
-		A compatibility space in an space where lock requests are assumed to be
-        compatabile and granted by the lock manager if the trio
-        {compatabilitySpace, ref, qualifier} are equal (i.e. reference equality
-        for qualifier, equals() method
-		for compatabilitySpace and ref ). A typical reference to use for the compatability
-		space is a reference to an object representing a transaction.
-		Granted by the lock manager means that the Lockable object may or may 
-        not be queried to see if the request is compatible.
-		<BR>
-		A compatability space is not assumed to be owned by a single thread.
-	
-
-
-		@param compatabilitySpace object defining compatability space (by value)
-		@param group handle of group, must be private to a thread.
-		@param ref reference to object to be locked
-		@param qualifier A qualification of the request.
-
-		@exception org.apache.derby.iapi.error.StandardException A deadlock has occured (message
id will be LockFactory.Deadlock)
-		@exception org.apache.derby.iapi.error.StandardException Another thread interupted this
thread while
-		it was waiting for the lock. This will be a StandardException with a nested java.lang.InterruptedException
exception,
-		(message id will be LockFactory.InterruptedExceptionId)
-		@exception StandardException Standard Cloudscape error policy.
-
-	*/
-	//public void lockObject(Object compatabilitySpace, Object group, Lockable ref, Object qualifier)
-	//	throws StandardException;
-
-	/**
 		Unlock a single lock on a single object held within this compatability space
 		that was locked with the supplied qualifier.
 
@@ -159,37 +126,6 @@
 	*/
 	public boolean areLocksHeld(Object compatabilitySpace);
 
-
-	/**
-		Latch an object. A latch is a lock without a group.
-		This means that it must be released explicitly by the owner.
-		A latch is not released by any unlock methods, it must be
-		released by the unlatch method. A latch is assumed to only
-		be held by one locker at a time.
-<BR>
-		The first argument passed to lockEvent() is the Latch that
-		is to be used in the unlatch() call.
-		The firstArgument passed to unlockEvent() should be ignored.
-
-  		@return true if the latch was obtained,
-		false if timeout is equal to LockFactory.NO_WAIT and the lock could not be granted.
-
-
-		@exception org.apache.derby.iapi.error.StandardException A deadlock has occured (message
id will be LockFactory.Deadlock)
-		@exception org.apache.derby.iapi.error.StandardException Another thread interupted this
thread while
-		it was waiting for the latch. This will be a StandardException with a nested java.lang.InterruptedException
exception,
-		(message id will be LockFactory.InterruptedExceptionId)
-		@exception StandardException Standard Cloudscape error policy.
-	*/
-	public boolean latchObject(Object compatabilitySpace, Lockable ref, Object qualifier, int
timeout)
-		throws StandardException;
-
-	/**
-		Unlatch an object.
-	*/
-	public void unlatch(Latch heldLatch);
-
-	
 	/**
 		Lock an object with zero duration within a compatability space,
 		waits up to timeout milli-seconds for the object to become unlocked. A 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/SinglePool.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/SinglePool.java?view=diff&rev=504462&r1=504461&r2=504462
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/SinglePool.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/locks/SinglePool.java Wed
Feb  7 00:45:55 2007
@@ -21,12 +21,9 @@
 
 package org.apache.derby.impl.services.locks;
 
-import org.apache.derby.iapi.services.monitor.Monitor;
-
 import org.apache.derby.iapi.services.locks.LockFactory;
 import org.apache.derby.iapi.services.locks.C_LockFactory;
 import org.apache.derby.iapi.services.locks.Lockable;
-import org.apache.derby.iapi.services.locks.Latch;
 import org.apache.derby.iapi.services.locks.Limit;
 
 import org.apache.derby.iapi.error.StandardException;
@@ -39,24 +36,14 @@
 import org.apache.derby.iapi.reference.Property;
 
 import java.util.Hashtable;
-import java.util.Properties;
 import java.io.Serializable;
 import java.util.Dictionary;
 import java.util.Enumeration;
 
-// debugging
-import org.apache.derby.iapi.services.stream.HeaderPrintWriter;
-
 /**
 	An implementation of LockFactory that uses a single pool
 	for the locks, i.e. all lock requests go through a single
 	point of synchronisation.
-    <p>
-    The default concrete class "SinglePool.java", prints nothing and thus 
-    incurs no overhead associated with the code to dump lock information.  An
-    alternate concrete class "LockDebug/TracingSinglePool.java", attempts to 
-    output only lock information that "makes sense" to a user - for instance it
-    doesn't print latch locks.
 
     <BR>
 	MT - Mutable - Container Object : Thread Aware
@@ -105,41 +92,6 @@
 	/*
 	** Methods of LockFactory
 	*/
-
-	/**
-		Latch a specific object with a timeout.
-
-		<BR>
-		MT - thread safe
-
-		@exception StandardException Standard Cloudscape error policy
-
-		@see LockFactory#latchObject
-	*/
-	public boolean latchObject(Object compatabilitySpace, Lockable ref, Object qualifier, int
timeout) 
-		throws StandardException {
-
-		Lock latch = lockTable.lockObject(compatabilitySpace, ref, qualifier,
-										  timeout);
-
-		if (SanityManager.DEBUG) {
-			if (latch == null)
-				SanityManager.ASSERT(timeout == C_LockFactory.NO_WAIT, "timeout not NO_WAIT");
-		}
-		return latch != null;
-	}
-
-	/**
-		Unlatch an  object.
-
-		<BR>
-		MT - thread safe
-
-		@see LockFactory#unlatch
-	*/
-	public void unlatch(Latch heldLatch) {
-		lockTable.unlock(heldLatch, 1);
-	}
 
 	/**
 		Lock a specific object with a timeout.

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/services/T_LockFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/services/T_LockFactory.java?view=diff&rev=504462&r1=504461&r2=504462
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/services/T_LockFactory.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/services/T_LockFactory.java
Wed Feb  7 00:45:55 2007
@@ -91,7 +91,6 @@
 			S004();
 			S005();
 			S007();
-			S008();
 
 			M001();
 			M002();
@@ -498,81 +497,6 @@
 
 		PASS("S007");
 	}
-
-	/**
-		Single user API test 008.
-
-		Create two compatability spaces and ensure that locks/latches
-		block each other out.
-
-		This test case originally tested that latches were released when a row
-		lock couldn't be obtained immediately, but LockFactory doesn't have
-		that functionality any more after DERBY-2197.
-
-		@exception StandardException	An exception thrown by a method of LockFactory
-		@exception T_Fail	Some behaviour of the LockFactory is incorrect
-	*/
-	void S008() throws StandardException, T_Fail {
-
-		Object cs0 = new Object();	// create an object for the compatability space
-		Object cs1 = new Object();	// create an object for the compatability space
-
-		Object g0 = new Object();
-		Object g1 = new Object();
-
-		T_L1 page = new T_L1();
-		Lockable rA = new T_L1();
-		Lockable rB = new T_L1();
-
-		int count;
-
-		// Simulate a page/row lock type access
-		lf.latchObject(cs0, page, null, C_LockFactory.WAIT_FOREVER);
-		lf.lockObject(cs0, g0, rA, null, C_LockFactory.WAIT_FOREVER);
-		lf.unlatch(page.latch);
-
-		lf.latchObject(cs1, page, null, C_LockFactory.WAIT_FOREVER);
-		lf.lockObject(cs1, g1, rB, null, C_LockFactory.WAIT_FOREVER);
-
-		checkLockCount(cs0, 1);
-		checkLockCount(cs1, 2);
-
-		try {
-			lf.lockObject(cs1, g1, rA, null, 5000);
-			throw T_Fail.testFailMsg("lock succeeded on already locked object");
-		}
-		catch (StandardException lfe) {
-			// we are expecting the timoeut exception, anything else is an error
-			if (!lfe.getMessageId().equals(SQLState.LOCK_TIMEOUT)) {
-				throw lfe;
-			}
-			checkLockCount(cs0, 1);
-			checkLockCount(cs1, 1);
-		}
-
-        try {
-            // make sure latch is held
-            lf.latchObject(cs0, page, null, 5000);
-			throw T_Fail.testFailMsg("latch succeeded on already latch object");
-        }
-		catch (StandardException lfe) {
-			// we are expecting timoeut exception, anything else is an error
-			if (!lfe.getMessageId().equals(SQLState.LOCK_TIMEOUT)) {
-				throw lfe;
-			}
-		}
-
-		lf.unlatch(page.latch);
-
-		lf.unlock(cs0,  g0, rA, null);
-		lf.unlock(cs1,  g0, rB, null);
-
-		PASS("S008");
-
-
-	}	
-
-
 
 	/*
 	** Multi-user tests.



Mime
View raw message