Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 82587 invoked from network); 18 Jan 2011 18:54:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 Jan 2011 18:54:06 -0000 Received: (qmail 87179 invoked by uid 500); 18 Jan 2011 18:54:06 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 87114 invoked by uid 500); 18 Jan 2011 18:54:06 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 87103 invoked by uid 99); 18 Jan 2011 18:54:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Jan 2011 18:54:06 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Jan 2011 18:54:05 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3392423889DD; Tue, 18 Jan 2011 18:53:45 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1060535 - in /db/derby/code/trunk/java: client/org/apache/derby/client/am/ client/org/apache/derby/client/net/ engine/org/apache/derby/impl/jdbc/ Date: Tue, 18 Jan 2011 18:53:45 -0000 To: derby-commits@db.apache.org From: rhillegas@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110118185345.3392423889DD@eris.apache.org> Author: rhillegas Date: Tue Jan 18 18:53:44 2011 New Revision: 1060535 URL: http://svn.apache.org/viewvc?rev=1060535&view=rev Log: DERBY-4869: Hide some behavior in the physical connections which we don't want to be visible to applications. Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/Connection.java db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection40.java db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection40.java 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=1060535&r1=1060534&r2=1060535&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 Tue Jan 18 18:53:44 2011 @@ -30,7 +30,7 @@ import org.apache.derby.client.net.NetXA import org.apache.derby.shared.common.sanity.SanityManager; public abstract class Connection - implements java.sql.Connection, ConnectionCallbackInterface, Runnable + implements java.sql.Connection, ConnectionCallbackInterface { //---------------------navigational members----------------------------------- @@ -2471,31 +2471,11 @@ public abstract class Connection public boolean isAborting() { return aborting_; } /** Begin aborting the connection */ - public void beginAborting() + protected void beginAborting() { aborting_ = true; markClosed( false ); } - ////////////////////////////////////////////////////////// - // - // Runnable BEHAVIOR - // - // This class implements Runnable so that the JDBC 4.1 abort(Executor) - // method can run the closeX() logic in a separate thread if necessary. - // - ////////////////////////////////////////////////////////// - - public void run() - { - try { - rollback(); - close(); - } catch (SQLException se) - { - se.printStackTrace( agent_.getLogWriter() ); - } - } - } Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection40.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection40.java?rev=1060535&r1=1060534&r2=1060535&view=diff ============================================================================== --- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection40.java (original) +++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection40.java Tue Jan 18 18:53:44 2011 @@ -434,10 +434,21 @@ public class NetConnection40 extends or beginAborting(); // - // The run() method in Connection does the - // actual releasing of resources. + // Now pass the Executor a Runnable which does the real work. // - executor.execute( this ); + executor.execute + ( + new Runnable() + { + public void run() + { + try { + rollback(); + close(); + } catch (SQLException se) { se.printStackTrace( agent_.getLogWriter() ); } + } + } + ); } } Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java?rev=1060535&r1=1060534&r2=1060535&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java Tue Jan 18 18:53:44 2011 @@ -115,10 +115,10 @@ import org.apache.derby.impl.jdbc.authen * @see TransactionResourceImpl * */ -public abstract class EmbedConnection implements EngineConnection, Runnable +public abstract class EmbedConnection implements EngineConnection { - private static final StandardException exceptionClose = StandardException.closeException(); + protected static final StandardException exceptionClose = StandardException.closeException(); /** * Static exception to be thrown when a Connection request can not @@ -1891,7 +1891,7 @@ public abstract class EmbedConnection im // // NOTE: This method is not part of JDBC specs. // - private void close(StandardException e) throws SQLException { + protected void close(StandardException e) throws SQLException { synchronized(getConnectionSynchronization()) { @@ -3330,27 +3330,10 @@ public abstract class EmbedConnection im public boolean isAborting() { return aborting; } /** Begin aborting the connection */ - public void beginAborting() + protected void beginAborting() { aborting = true; setInactive(); } - - ////////////////////////////////////////////////////////// - // - // Runnable BEHAVIOR - // - // This class implements Runnable so that the JDBC 4.1 abort(Executor) - // method can run the close() logic in a separate thread if necessary. - // - ////////////////////////////////////////////////////////// - - public void run() - { - try { - rollback(); - close(exceptionClose); - } catch (SQLException se) { Util.logSQLException( se ); } - } - + } Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection40.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection40.java?rev=1060535&r1=1060534&r2=1060535&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection40.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection40.java Tue Jan 18 18:53:44 2011 @@ -301,10 +301,21 @@ public class EmbedConnection40 extends E beginAborting(); // - // The run() method in EmbedConnection does the - // actual releasing of resources. + // Now pass the Executor a Runnable which does the real work. // - executor.execute( this ); + executor.execute + ( + new Runnable() + { + public void run() + { + try { + rollback(); + close(exceptionClose); + } catch (SQLException se) { Util.logSQLException( se ); } + } + } + ); } }