You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ka...@apache.org on 2007/10/22 10:43:48 UTC

svn commit: r587034 - /db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/conn/GenericStatementContext.java

Author: kahatlen
Date: Mon Oct 22 01:43:47 2007
New Revision: 587034

URL: http://svn.apache.org/viewvc?rev=587034&view=rev
Log:
DERBY-3093: Intermittent transaction failure caused by internal duplicate savepoint name for triggers

Merged fix from trunk (revision 586956).

Modified:
    db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/conn/GenericStatementContext.java

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/conn/GenericStatementContext.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/conn/GenericStatementContext.java?rev=587034&r1=587033&r2=587034&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/conn/GenericStatementContext.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/conn/GenericStatementContext.java Mon Oct 22 01:43:47 2007
@@ -99,6 +99,9 @@
 	*/
 	private short			sqlAllowed = -1;
 
+    // Counter used to create unique savepoint names.
+    private static long nextNameId = Long.MIN_VALUE;
+
 	/*
 	   constructor
 		@param tc transaction
@@ -109,7 +112,7 @@
 		this.lcc = lcc;
 		this.tc = tc;
 
-		internalSavePointName = "ISSP" + hashCode();
+        internalSavePointName = createInternalSavepointName();
 
 		if (SanityManager.DEBUG)
 		{
@@ -118,6 +121,16 @@
 		}
 
 	}
+
+    /**
+     * Generate a unique name for this savepoint.
+     * This method should only be called from the constructor.
+     *
+     * @return the savepoint name.
+     */
+    private synchronized static String createInternalSavepointName() {
+        return "ISSP" + nextNameId++;
+    }
 
     /**
      * This is a TimerTask that is responsible for timing out statements,