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 kr...@apache.org on 2008/04/18 13:56:13 UTC

svn commit: r649473 - in /db/derby/code/trunk/java/client/org/apache/derby/client: ClientPooledConnection.java am/Connection.java net/NetConnection.java

Author: kristwaa
Date: Fri Apr 18 04:56:08 2008
New Revision: 649473

URL: http://svn.apache.org/viewvc?rev=649473&view=rev
Log:
DERBY-3581 (partial): Changing certain properties on client DataSource objects causes existing connections to reflect the new values.
Removed data source reference from ClientPooledConnection, and also removed usage of "the new datasource reference" (new as in passed in from CPC) in Connection/NetConnection.
Patch file: derby-3581-2a-remove_datasource_iteration1.diff

Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/ClientPooledConnection.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/Connection.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/ClientPooledConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/ClientPooledConnection.java?rev=649473&r1=649472&r2=649473&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/ClientPooledConnection.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/ClientPooledConnection.java Fri Apr 18 04:56:08 2008
@@ -67,9 +67,6 @@
     /** Resource manager identificator. */
     protected int rmId_ = 0;
 
-    // Cached stuff from constructor
-    private ClientBaseDataSource ds_;
-
     /**
      * Constructor for non-XA pooled connections.
      * <p>
@@ -88,7 +85,6 @@
                                   String user,
                                   String password) throws SQLException {
         logWriter_ = logWriter;
-        ds_ = ds;
         listeners_ = new ArrayList();
 
         if (ds.maxStatementsToPool() <= 0) {
@@ -141,7 +137,6 @@
                                   String password,
                                   int rmId) throws SQLException {
         logWriter_ = logWriter;
-        ds_ = ds;
         rmId_ = rmId;
         listeners_ = new ArrayList();
 
@@ -238,7 +233,7 @@
             	// to reset the connection state to the default on 
             	// PooledConnection.getConnection() otherwise the 
             	// isolation level and holdability was not correct and out of sync with the server.
-                physicalConnection_.reset(logWriter_, ds_, true);
+                physicalConnection_.reset(logWriter_, true);
             }
             else {
                 physicalConnection_.lightReset();    //poolfix

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/Connection.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/Connection.java?rev=649473&r1=649472&r2=649473&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 Fri Apr 18 04:56:08 2008
@@ -271,16 +271,12 @@
 
     // This is a callback method, called by subsystem - NetConnection
     protected void resetConnection(LogWriter logWriter,
-                                   ClientBaseDataSource ds,
                                    boolean recomputeFromDataSource) throws SqlException {
         // Transaction isolation level is handled in completeReset.
         // clearWarningsX() will re-initialize the following properties
         clearWarningsX();
 
-        if (ds != null && recomputeFromDataSource) { // no need to reinitialize connection state if ds hasn't changed
-            retrieveMessageText_ = ds.getRetrieveMessageText();
-
-
+        if (recomputeFromDataSource) { // no need to reinitialize connection state if ds hasn't changed
             // property encryptionManager_
             // if needed this will later be initialized by NET calls to initializePublicKeyForEncryption()
             encryptionManager_ = null;
@@ -291,10 +287,6 @@
             currentSchemaName_ = null;
             autoCommit_ = true;
             inUnitOfWork_ = false;
-
-            loginTimeout_ = ds.getLoginTimeout();
-            dataSource_ = ds;
-            
             holdability = ResultSet.HOLD_CURSORS_OVER_COMMIT;
         }
 
@@ -2094,14 +2086,14 @@
     // can this be called in a unit of work
     // can this be called from within a stored procedure
     //
-    synchronized public void reset(LogWriter logWriter, ClientBaseDataSource ds, 
+    synchronized public void reset(LogWriter logWriter, 
             boolean recomputeFromDataSource) throws SqlException {
         if (logWriter != null) {
             logWriter.traceConnectResetEntry(this, logWriter, user_, 
-                                            (ds != null) ? ds : dataSource_);
+                                             dataSource_);
         }
         try {
-            reset_(logWriter, ds, recomputeFromDataSource);
+            reset_(logWriter, recomputeFromDataSource);
         } catch (SqlException sqle) {
             DisconnectException de = new DisconnectException(agent_, 
                 new ClientMessageId(SQLState.CONNECTION_FAILED_ON_RESET));
@@ -2118,7 +2110,7 @@
         availableForReuse_ = false;
     }
 
-    abstract protected void reset_(LogWriter logWriter, ClientBaseDataSource ds, 
+    abstract protected void reset_(LogWriter logWriter, 
             boolean recomputerFromDataSource) throws SqlException;
 
     /**

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection.java?rev=649473&r1=649472&r2=649473&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection.java Fri Apr 18 04:56:08 2008
@@ -307,9 +307,8 @@
     // preferably without password in the method signature.
     // We can probally get rid of flowReconnect method.
     public void resetNetConnection(org.apache.derby.client.am.LogWriter logWriter,
-                                   org.apache.derby.jdbc.ClientBaseDataSource ds,
                                    boolean recomputeFromDataSource) throws SqlException {
-        super.resetConnection(logWriter, ds, recomputeFromDataSource);
+        super.resetConnection(logWriter, recomputeFromDataSource);
         //----------------------------------------------------
         if (recomputeFromDataSource) {
             // do not reset managers on a connection reset.  this information shouldn't
@@ -324,10 +323,6 @@
             sourceSeed_ = null;
             targetSeed_ = null;
             targetSecmec_ = 0;
-            if (ds != null && securityMechanism_ == 0) {
-                securityMechanism_ =
-                        ds.getSecurityMechanism(getDeferredResetPassword());
-            }
             resetConnectionAtFirstSql_ = false;
 
         }
@@ -341,14 +336,13 @@
 
 
     protected void reset_(org.apache.derby.client.am.LogWriter logWriter,
-                          ClientBaseDataSource ds,
                           boolean recomputeFromDataSource) throws SqlException {
         if (inUnitOfWork_) {
             throw new SqlException(logWriter, 
                 new ClientMessageId(
                     SQLState.NET_CONNECTION_RESET_NOT_ALLOWED_IN_UNIT_OF_WORK));
         }
-        resetNetConnection(logWriter, ds, recomputeFromDataSource);
+        resetNetConnection(logWriter, recomputeFromDataSource);
     }
 
     java.util.List getSpecialRegisters() {