db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r406171 - /db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/ConnectionManagerImpl.java
Date Sun, 14 May 2006 00:17:05 GMT
Author: arminw
Date: Sat May 13 17:17:04 2006
New Revision: 406171

URL: http://svn.apache.org/viewcvs?rev=406171&view=rev
Log:
code cleanup

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/ConnectionManagerImpl.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/ConnectionManagerImpl.java
URL: http://svn.apache.org/viewcvs/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/ConnectionManagerImpl.java?rev=406171&r1=406170&r2=406171&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/ConnectionManagerImpl.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/ConnectionManagerImpl.java
Sat May 13 17:17:04 2006
@@ -19,13 +19,12 @@
 import java.sql.SQLException;
 
 import org.apache.ojb.broker.OJBRuntimeException;
-import org.apache.ojb.broker.PBKey;
 import org.apache.ojb.broker.PersistenceBroker;
 import org.apache.ojb.broker.PersistenceBrokerException;
+import org.apache.ojb.broker.PersistenceBrokerInternal;
 import org.apache.ojb.broker.TransactionAbortedException;
 import org.apache.ojb.broker.TransactionInProgressException;
 import org.apache.ojb.broker.TransactionNotInProgressException;
-import org.apache.ojb.broker.core.PersistenceBrokerImpl;
 import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
 import org.apache.ojb.broker.metadata.MetadataManager;
 import org.apache.ojb.broker.platforms.Platform;
@@ -38,19 +37,17 @@
  * Manages Connection ressources.
  *
  * @see ConnectionManagerIF
- * @author Thomas Mahler
  * @version $Id$
  */
 public class ConnectionManagerImpl implements ConnectionManagerIF
 {
     private Logger log = LoggerFactory.getLogger(ConnectionManagerImpl.class);
 
-    private PersistenceBrokerImpl broker = null;
+    private PersistenceBrokerInternal broker = null;
     private ConnectionFactory connectionFactory;
     private JdbcConnectionDescriptor jcd;
     private Platform platform;
     private Connection con = null;
-    private PBKey pbKey;
     private boolean originalAutoCommitState;
     private boolean isInLocalTransaction;
     private boolean batchMode;
@@ -59,9 +56,8 @@
     public ConnectionManagerImpl(PersistenceBroker broker)
     {
         // TODO: avoid this cast
-        this.broker = (PersistenceBrokerImpl) broker;
-        this.pbKey = broker.getPBKey();
-        this.jcd = MetadataManager.getInstance().connectionRepository().getDescriptor(pbKey);
+        this.broker = (PersistenceBrokerInternal) broker;
+        this.jcd = MetadataManager.getInstance().connectionRepository().getDescriptor(broker.getPBKey());
         this.connectionFactory = ConnectionFactoryFactory.getInstance().createConnectionFactory();
         this.platform = PlatformFactory.getPlatformFor(jcd);
         /*
@@ -157,7 +153,7 @@
         {
             throw new TransactionInProgressException("Connection is already in transaction");
         }
-        Connection connection = null;
+        Connection connection;
         try
         {
             connection = this.getConnection();
@@ -290,7 +286,7 @@
             if(!broker.isManaged())
             {
                 if (jcd.getUseAutoCommit() == JdbcConnectionDescriptor.AUTO_COMMIT_SET_TRUE_AND_TEMPORARY_FALSE
-                        && originalAutoCommitState == true && con != null
&& !con.isClosed())
+                        && originalAutoCommitState && con != null &&
!con.isClosed())
                 {
                     platform.changeAutoCommitState(jcd, con, true);
                 }
@@ -315,7 +311,7 @@
     {
         try
         {
-            return con != null ? !con.isClosed() : false;
+            return con != null && !con.isClosed();
         }
         catch (SQLException e)
         {



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message