db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r586956 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericStatementContext.java
Date Sun, 21 Oct 2007 21:11:23 GMT
Author: kahatlen
Date: Sun Oct 21 14:11:22 2007
New Revision: 586956

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

Don't use hashCode() to generate unique savepoint name.

Contributed by James F. Adams.

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

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericStatementContext.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericStatementContext.java?rev=586956&r1=586955&r2=586956&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericStatementContext.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericStatementContext.java
Sun Oct 21 14:11:22 2007
@@ -96,6 +96,9 @@
 	*/
 	private short			sqlAllowed = -1;
 
+    // Counter used to create unique savepoint names.
+    private static long nextNameId = Long.MIN_VALUE;
+
 	/*
 	   constructor
 		@param tc transaction
@@ -105,7 +108,7 @@
 		super(lcc.getContextManager(), org.apache.derby.iapi.reference.ContextId.LANG_STATEMENT);
 		this.lcc = lcc;
 
-		internalSavePointName = "ISSP" + hashCode();
+        internalSavePointName = createInternalSavepointName();
 
 		if (SanityManager.DEBUG)
 		{
@@ -114,6 +117,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,



Mime
View raw message