db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r370275 - in /db/derby/code/trunk/java: client/org/apache/derby/client/am/ testing/org/apache/derbyTesting/functionTests/master/ testing/org/apache/derbyTesting/functionTests/suites/ testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/
Date Wed, 18 Jan 2006 21:55:49 GMT
Author: kmarsden
Date: Wed Jan 18 13:55:36 2006
New Revision: 370275

URL: http://svn.apache.org/viewcvs?rev=370275&view=rev
Log:
DERBY-210 reverting change until jdk1.5 lang/updatableResultset.java diff can be resolved


Removed:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/derbyStress.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/derbyStress.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/derbyStress_app.properties
Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/Connection.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/Lob.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbcapi.runall

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/Connection.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/Connection.java?rev=370275&r1=370274&r2=370275&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Connection.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/Connection.java Wed Jan 18
13:55:36 2006
@@ -30,21 +30,20 @@
     public Agent agent_;
 
     public DatabaseMetaData databaseMetaData_;
-    
-    // WeakHashMap is used to store references so that the objects added to 
-    // the map can get garbage-collected without waiting for the Connection object.
-    
-    // When Connection.close() is called, this list is traversed and markClosed() 
-    // is called on all statements in this list.    
-    final java.util.WeakHashMap openStatements_ = new java.util.WeakHashMap();
+    // Since DERBY prepared statements must be re-prepared after a commit,
+    // then we must traverse this list after a commit and notify statements
+    // that they are now in an un-prepared state.
+    final java.util.LinkedList openStatements_ = new java.util.LinkedList();
 
-    // Some statuses of DERBY objects may be invalid on server after both 
-    // commit and rollback. For example,
+    // Some statuses of DERBY objects may be invalid on server either after only rollback
+    // or after both commit and rollback. For example,
     // (1) prepared statements need to be re-prepared
     //     after both commit and rollback
     // (2) result set will be unpositioned on server after both commit and rollback.
+    // If they only depend on rollback, they need to get on RollbackOnlyListeners_.
     // If they depend on both commit and rollback, they need to get on CommitAndRollbackListeners_.
-    final java.util.WeakHashMap CommitAndRollbackListeners_ = new java.util.WeakHashMap();
+    final java.util.LinkedList RollbackOnlyListeners_ = new java.util.LinkedList();
+    final java.util.LinkedList CommitAndRollbackListeners_ = new java.util.LinkedList();
     private SqlWarning warnings_ = null;
 
     // ------------------------properties set for life of connection--------------
@@ -395,7 +394,7 @@
         PreparedStatement ps = newPreparedStatement_(sql, java.sql.ResultSet.TYPE_FORWARD_ONLY,
java.sql.ResultSet.CONCUR_READ_ONLY, resultSetHoldability_, java.sql.Statement.NO_GENERATED_KEYS,
null);
         ps.isCatalogQuery_ = true;
         ps.prepare();
-        openStatements_.put(ps,null);
+        openStatements_.add(ps);
         return ps;
     }
 
@@ -738,6 +737,7 @@
         inUnitOfWork_ = false;
         markStatementsClosed();
         CommitAndRollbackListeners_.clear();
+        RollbackOnlyListeners_.clear();
         markClosed_();
     }
 
@@ -748,8 +748,7 @@
     }
 
     private void markStatementsClosed() {
-    	java.util.Set keySet = openStatements_.keySet();
-        for (java.util.Iterator i = keySet.iterator(); i.hasNext();) {
+        for (java.util.ListIterator i = openStatements_.listIterator(); i.hasNext();) {
             Statement stmt = (Statement) i.next();
             stmt.markClosed();
             i.remove();
@@ -757,15 +756,13 @@
     }
 
     private void writeCloseStatements() throws SqlException {
-    	java.util.Set keySet = openStatements_.keySet();
-        for (java.util.Iterator i = keySet.iterator(); i.hasNext();) {
+        for (java.util.ListIterator i = openStatements_.listIterator(); i.hasNext();) {
             ((Statement) i.next()).writeClose(false);  // false means don't permit auto-commits
         }
     }
 
     private void readCloseStatements() throws SqlException {
-    	java.util.Set keySet = openStatements_.keySet();
-        for (java.util.Iterator i = keySet.iterator(); i.hasNext();) {
+        for (java.util.ListIterator i = openStatements_.listIterator(); i.hasNext();) {
             ((Statement) i.next()).readClose(false);  // false means don't permit auto-commits
         }
     }
@@ -1223,7 +1220,7 @@
         resultSetConcurrency = downgradeResultSetConcurrency(resultSetConcurrency, resultSetType);
         Statement s = newStatement_(resultSetType, resultSetConcurrency, resultSetHoldability);
         s.cursorAttributesToSendOnPrepare_ = s.cacheCursorAttributesToSendOnPrepare();
-        openStatements_.put(s,null);
+        openStatements_.add(s);
         return s;
     }
 
@@ -1269,7 +1266,7 @@
         PreparedStatement ps = newPreparedStatement_(sql, resultSetType, resultSetConcurrency,
resultSetHoldability, autoGeneratedKeys, columnNames);
         ps.cursorAttributesToSendOnPrepare_ = ps.cacheCursorAttributesToSendOnPrepare();
         ps.prepare();
-        openStatements_.put(ps,null);
+        openStatements_.add(ps);
         return ps;
     }
 
@@ -1307,7 +1304,7 @@
         CallableStatement cs = newCallableStatement_(sql, resultSetType, resultSetConcurrency,
resultSetHoldability);
         cs.cursorAttributesToSendOnPrepare_ = cs.cacheCursorAttributesToSendOnPrepare();
         cs.prepare();
-        openStatements_.put(cs,null);
+        openStatements_.add(cs);
         return cs;
     }
 
@@ -1447,8 +1444,7 @@
     public abstract void readLocalCommit_() throws SqlException;
 
     public void completeLocalCommit() {
-    	java.util.Set keySet = CommitAndRollbackListeners_.keySet();
-        for (java.util.Iterator i = keySet.iterator(); i.hasNext();) {
+        for (java.util.Iterator i = CommitAndRollbackListeners_.iterator(); i.hasNext();)
{
             UnitOfWorkListener listener = (UnitOfWorkListener) i.next();
             listener.completeLocalCommit(i);
         }
@@ -1463,8 +1459,11 @@
     // This is a client-side only operation.
     // This method will only throw an exception on bug check.
     public void completeLocalRollback() {
-    	java.util.Set keySet = CommitAndRollbackListeners_.keySet();
-        for (java.util.Iterator i = keySet.iterator(); i.hasNext();) {
+        for (java.util.Iterator i = CommitAndRollbackListeners_.iterator(); i.hasNext();)
{
+            UnitOfWorkListener listener = (UnitOfWorkListener) i.next();
+            listener.completeLocalRollback(i);
+        }
+        for (java.util.Iterator i = RollbackOnlyListeners_.iterator(); i.hasNext();) {
             UnitOfWorkListener listener = (UnitOfWorkListener) i.next();
             listener.completeLocalRollback(i);
         }
@@ -1566,8 +1565,7 @@
         // Notice that these physical statements may not belong to this logical connection.
         // Iterate through the physical statements and re-enable them for reuse.
 
-        java.util.Set keySet = openStatements_.keySet();
-        for (java.util.Iterator i = keySet.iterator(); i.hasNext();) {
+        for (java.util.Iterator i = openStatements_.iterator(); i.hasNext();) {
             Object o = i.next();
             ((Statement) o).reset(recomputeFromDataSource);
 

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/Lob.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/Lob.java?rev=370275&r1=370274&r2=370275&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Lob.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/Lob.java Wed Jan 18 13:55:36
2006
@@ -64,7 +64,7 @@
     //-----------------------event callback methods-------------------------------
 
     public void listenToUnitOfWork() {
-        agent_.connection_.CommitAndRollbackListeners_.put(this,null);
+        agent_.connection_.CommitAndRollbackListeners_.add(this);
     }
 
     public void completeLocalCommit(java.util.Iterator listenerIterator) {

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java?rev=370275&r1=370274&r2=370275&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java Wed
Jan 18 13:55:36 2006
@@ -1613,7 +1613,7 @@
     public void listenToUnitOfWork() {
         if (!listenToUnitOfWork_) {
             listenToUnitOfWork_ = true;
-            connection_.CommitAndRollbackListeners_.put(this,null);
+            connection_.CommitAndRollbackListeners_.add(this);
         }
     }
 

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java?rev=370275&r1=370274&r2=370275&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java Wed Jan 18 13:55:36
2006
@@ -3055,7 +3055,7 @@
     public void listenToUnitOfWork() {
         if (!listenToUnitOfWork_) {
             listenToUnitOfWork_ = true;
-            connection_.CommitAndRollbackListeners_.put(this,null);
+            connection_.CommitAndRollbackListeners_.add(this);
         }
     }
 

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java?rev=370275&r1=370274&r2=370275&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java Wed Jan 18 13:55:36
2006
@@ -2017,18 +2017,12 @@
     }
 
     // Only called on positioned upate statements
-    //Removing resultset from hashtable is called for all statements
     void resetCursorNameAndRemoveFromWhereCurrentOfMappings() {
         // Remove client/server cursorName -> ResultSet mapping from the hashtable.
         // If Statement.close() is called before ResultSet.close(), then statement_.section
is null.
         if (section_ != null) {
             agent_.sectionManager_.removeCursorNameToResultSetMapping(cursorName_,
                     section_.getServerCursorNameForPositionedUpdate());
-            
-            // remove resultset mapping for other cursors (other than positioned
-            // update statements)
-            agent_.sectionManager_.removeCursorNameToResultSetMapping(cursorName_,
-                    section_.getServerCursorName());
 
             // Remove client and server cursorName -> QuerySection mapping from the hashtable
             // if one exists

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude?rev=370275&r1=370274&r2=370275&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude
Wed Jan 18 13:55:36 2006
@@ -12,7 +12,6 @@
 # excluding jdbcapi/statementJdbc30.java - Client behaves differently. Need to look into
this
 # excluding jdbcapi/holdCursorJava.java - JCC behaves differently with hold cursors.
 # excluding jdbcapi/dataSourceReference.java - client side only tests, tests all data sources
-# excluding jdbcapi/derbyStress.java - jcc runs out of memory with this test
 #           regardless of framework
 jdbcapi/resultsetStream.java
 lang/errorStream.java
@@ -29,4 +28,3 @@
 jdbcapi/statementJdbc30.java
 lang/holdCursorJava.java
 jdbcapi/dataSourceReference.java
-jdbcapi/derbyStress.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbcapi.runall
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbcapi.runall?rev=370275&r1=370274&r2=370275&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbcapi.runall
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbcapi.runall
Wed Jan 18 13:55:36 2006
@@ -1,7 +1,6 @@
 jdbcapi/bestrowidentifier.sql
 jdbcapi/characterStreams.java
 jdbcapi/checkDriver.java
-jdbcapi/derbyStress.java
 jdbcapi/nullSQLText.java
 jdbcapi/prepStmtMetaData.java
 jdbcapi/resultset.java



Mime
View raw message