db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r1429912 - in /db/derby/code/branches/10.1: ./ java/engine/org/apache/derby/impl/store/raw/data/BaseContainerHandle.java java/engine/org/apache/derby/impl/store/raw/data/D_BaseContainerHandle.java
Date Mon, 07 Jan 2013 17:24:11 GMT
Author: kmarsden
Date: Mon Jan  7 17:24:11 2013
New Revision: 1429912

URL: http://svn.apache.org/viewvc?rev=1429912&view=rev
Log:
DERBY-2141  BlobClob4BlobTest.testPositionBlob() fails with NullPointerException



Modified:
    db/derby/code/branches/10.1/   (props changed)
    db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/store/raw/data/BaseContainerHandle.java
    db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/store/raw/data/D_BaseContainerHandle.java

Propchange: db/derby/code/branches/10.1/
------------------------------------------------------------------------------
  Merged /db/derby/code/trunk:r537091

Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/store/raw/data/BaseContainerHandle.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/store/raw/data/BaseContainerHandle.java?rev=1429912&r1=1429911&r2=1429912&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/store/raw/data/BaseContainerHandle.java
(original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/store/raw/data/BaseContainerHandle.java
Mon Jan  7 17:24:11 2013
@@ -73,21 +73,21 @@ public class BaseContainerHandle extends
 		Container identifier
 		<BR> MT - Immutable
 	*/
-	protected /*final*/ ContainerKey		identity;
+	private /*final*/ ContainerKey		identity;
 
 	/**
 		Is this ContainerHandle active.
 
 		<BR> MT - Mutable : scoped
 	*/
-	protected boolean				active;	
+	private boolean				        active;	
 
 	/**
 		The actual container we are accessing. Only valid when active is true.
 
 		<BR> MT - Mutable : scoped
 	*/
-	protected BaseContainer		container;
+	protected BaseContainer		        container;
 
 	/**
 		the locking policy we opened the container with. 
@@ -96,27 +96,31 @@ public class BaseContainerHandle extends
 		<BR> MT - Mutable : scoped
 	*/
 
-	private	LockingPolicy		locking;
+	private	LockingPolicy		        locking;
 
 	/**
 		our transaction. Only valid when active is true.
 
 		<BR> MT - Mutable : scoped
 	*/
-	protected	RawTransaction		xact;
+	private	RawTransaction		        xact;
 
 	/**
 		are we going to update?
 
 		<BR> MT - Immutable after container handle becomes active
 	*/
-	private	boolean		forUpdate;
+	private	boolean		                forUpdate;
 
-	protected int mode;	// mode the container was opened in
 
+    /**
+     * mode the conainter was opened in.
+     **/
+	private int                         mode;
 
-	protected PageActions		actionsSet;
-	protected AllocationActions allocActionsSet;
+
+	private PageActions		            actionsSet;
+	private AllocationActions           allocActionsSet;
 
 
 	/*
@@ -374,39 +378,42 @@ public class BaseContainerHandle extends
 		@see ContainerHandle#close
 	*/
 
-	public void close() 
+	public synchronized void close() 
     {
+        // Close may be called by multiple threads concurrently, for
+        // instance it can be called automatically after an abort and
+        // explicitly by a client.  Depending on timing of machine
+        // these calls may happen concurrently.  Thus close needs to
+        // be synchronized.  
+        //
+        // Another example is that we may hand out an indirect reference
+        // to clients outside of JDBC through an OverFlowInputStream.  
+        // Derby code cannot control when clients may close those 
+        // streams with respect to implicit closes by abort.
 
         if (xact == null) 
         {
-            // Probably be closed explicitly by a client, after closing 
-            // automatically after an abort.
-            
-            if (SanityManager.DEBUG)
-                SanityManager.ASSERT(!active);
-
             return;
         }
 
-		// notify our observers (Pages) that we are closing ...
-		informObservers();
+        // notify our observers (Pages) that we are closing ...
+        informObservers();
 
-		active = false;
+        active = false;
 
-		getLockingPolicy().unlockContainer(xact, this);
+        getLockingPolicy().unlockContainer(xact, this);
 
-		// let go of the container
-		if (container != null) 
+        // let go of the container
+        if (container != null) 
         {
-			container.letGo(this);
-			container = null;
-		}
+            container.letGo(this);
+            container = null;
+        }
 
-		// and remove ourseleves from this transaction
+        // and remove ourseleves from this transaction
         xact.deleteObserver(this);
 
-		xact = null;
-		
+        xact = null;
 	}
 
 	/* cost estimation */

Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/store/raw/data/D_BaseContainerHandle.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/store/raw/data/D_BaseContainerHandle.java?rev=1429912&r1=1429911&r2=1429912&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/store/raw/data/D_BaseContainerHandle.java
(original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/store/raw/data/D_BaseContainerHandle.java
Mon Jan  7 17:24:11 2013
@@ -62,11 +62,11 @@ public class D_BaseContainerHandle exten
             ")";
         */
 
-        long container_id = ch.identity.getContainerId();
+        long container_id = ch.getId().getContainerId();
 
         long conglom_id   = 
             D_DiagnosticUtil.diag_containerid_to_conglomid(
-                    ch.xact.getDataFactory(),
+                    ch.getTransaction().getDataFactory(),
                     container_id);
 
         if (conglom_id !=  Long.MIN_VALUE)



Mime
View raw message