You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jo...@apache.org on 2001/08/07 20:20:53 UTC
cvs commit: jakarta-turbine-torque/src/java/org/apache/torque/pool DBConnection.java
jon 01/08/07 11:20:53
Modified: src/java/org/apache/torque/pool DBConnection.java
Log:
code formatting cleanup
Revision Changes Path
1.2 +29 -26 jakarta-turbine-torque/src/java/org/apache/torque/pool/DBConnection.java
Index: DBConnection.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/pool/DBConnection.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DBConnection.java 2001/08/02 05:08:19 1.1
+++ DBConnection.java 2001/08/07 18:20:53 1.2
@@ -79,7 +79,7 @@
* @author <a href="mailto:dlr@collab.net">Daniel L. Rall</a>
* @author <a href="mailto:magnus@handtolvur.is">Magn�s ��r Torfason</a>
* @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
- * @version $Id: DBConnection.java,v 1.1 2001/08/02 05:08:19 jvanzyl Exp $
+ * @version $Id: DBConnection.java,v 1.2 2001/08/07 18:20:53 jon Exp $
*/
public class DBConnection
implements ConnectionEventListener
@@ -223,8 +223,9 @@
// to a ConnectionPool, it means that it was taken from a pool
// and not returned. We log this fact, close the underlying
// Connection, and return it to the ConnectionPool.
- Torque.getCategory().warn( "A DBConnection was finalized, without being returned "
- + "to the ConnectionPool it belonged to" );
+ Torque.getCategory().warn(
+ "A DBConnection was finalized, without being returned "
+ + "to the ConnectionPool it belonged to" );
// Closing the Connection ensures that if anyone tries to use it,
// an error will occur.
@@ -236,7 +237,6 @@
}
}
-
/**
* Links this DBConnection with a ConnectionPool.
*
@@ -254,7 +254,7 @@
//If we use a PooledConnection object, then request from it a Connection
//object. This forces the PooledConnection to create a wrapper for the
- //physical connection it represents and return a Torque.getCategory()ical Connection object
+ //physical connection it represents and return a local Connection object
//that is currently in control of it.
if ( pooledConnection != null )
{
@@ -270,7 +270,6 @@
//ignore this
}
}
-
}
/**
@@ -294,16 +293,16 @@
if ( pooledConnection != null )
{
if ( connection != null )
- try
- {
- //this will not close the physical connection, just the
- //logical connection
- connection.close();
- }
- catch (Exception ex)
- {
- //ignore this exception
- }
+ try
+ {
+ //this will not close the physical connection, just the
+ //logical connection
+ connection.close();
+ }
+ catch (Exception ex)
+ {
+ //ignore this exception
+ }
connection = null;
}
}
@@ -510,8 +509,9 @@
public void close()
throws SQLException
{
- //if using pooledConnection, close this (not the connection
- if ( pooledConnection != null ){
+ //if using pooledConnection, close this (not the connection
+ if ( pooledConnection != null )
+ {
connection = null;
pooledConnection.removeConnectionEventListener(this);
pooledConnection.close();
@@ -539,7 +539,8 @@
* method of this connection object. What we need to do here is to
* release this DBConnection from our pool...
*/
- public void connectionClosed(ConnectionEvent event) {
+ public void connectionClosed(ConnectionEvent event)
+ {
try
{
pool.releaseConnection(this);
@@ -554,12 +555,15 @@
* If a fatal error occurs, close the undelying physical connection so as not to
* be returned in the future
*/
- public void connectionErrorOccurred(ConnectionEvent e) {
- try {
+ public void connectionErrorOccurred(ConnectionEvent e)
+ {
+ try
+ {
System.err.println("CLOSING DOWN CONNECTION DUE TO INTERNAL ERROR");
//remove this from the listener list because we are no more interested in errors
//since we are about to close this connection
( (PooledConnection) e.getSource() ).removeConnectionEventListener(this);
+
try
{
//this one will close the underlying physical connection
@@ -570,8 +574,8 @@
//just ignore
}
- //this will also close the Torque.getCategory()ical Connection object so a future
- //call to isClosed() will return true
+ //this will also close the Torque.getCategory()ical Connection object so a future
+ //call to isClosed() will return true
try
{
connection.close();
@@ -580,13 +584,12 @@
{
//ignore
}
-
}
- catch (Exception ignore) {
+ catch (Exception ignore)
+ {
//just ignore
}
}
-
/*
public CallableStatement prepareCall(String sql) throws SQLException {
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org