aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r1653259 - /aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/XADataSourceMCFFactory.java
Date Tue, 20 Jan 2015 14:39:43 GMT
Author: gnodet
Date: Tue Jan 20 14:39:42 2015
New Revision: 1653259

URL: http://svn.apache.org/r1653259
Log:
[ARIES-1287] Forcing auto-commit on Oracle JDBC connection that is still part of a transaction
breaks transactional behavior

Modified:
    aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/XADataSourceMCFFactory.java

Modified: aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/XADataSourceMCFFactory.java
URL: http://svn.apache.org/viewvc/aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/XADataSourceMCFFactory.java?rev=1653259&r1=1653258&r2=1653259&view=diff
==============================================================================
--- aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/XADataSourceMCFFactory.java
(original)
+++ aries/trunk/transaction/transaction-jdbc/src/main/java/org/apache/aries/transaction/jdbc/internal/XADataSourceMCFFactory.java
Tue Jan 20 14:39:42 2015
@@ -25,11 +25,15 @@ import org.tranql.connector.NoExceptions
 import org.tranql.connector.jdbc.AbstractXADataSourceMCF;
 import org.tranql.connector.jdbc.ConfigurableSQLStateExceptionSorter;
 import org.tranql.connector.jdbc.KnownSQLStateExceptionSorter;
+import org.tranql.connector.jdbc.ManagedXAConnection;
 
 import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.ManagedConnection;
 import javax.resource.spi.ManagedConnectionFactory;
 import javax.resource.spi.ResourceAdapterInternalException;
 import javax.resource.spi.TransactionSupport;
+import javax.security.auth.Subject;
 import javax.sql.XAConnection;
 import javax.sql.XADataSource;
 
@@ -64,6 +68,26 @@ public class XADataSourceMCFFactory exte
         }
 
         @Override
+        public ManagedConnection createManagedConnection(Subject subject, ConnectionRequestInfo
connectionRequestInfo) throws ResourceException {
+            CredentialExtractor credentialExtractor = new CredentialExtractor(subject, connectionRequestInfo,
this);
+
+            XAConnection sqlConnection = getPhysicalConnection(credentialExtractor);
+            try {
+                return new ManagedXAConnection(this, sqlConnection, credentialExtractor,
exceptionSorter) {
+                    @Override
+                    public void cleanup() throws ResourceException {
+                        // ARIES-1279 - Transaction does not work on error SQLException
+                        // that's why we don't call super.cleanup() which calls con.setAutocommit(true)
+                        // super.cleanup();
+                        dissociateConnections();
+                    }
+                };
+            } catch (SQLException e) {
+                throw new ResourceAdapterInternalException("Could not set up ManagedXAConnection",
e);
+            }
+        }
+
+        @Override
         protected XAConnection getPhysicalConnection(CredentialExtractor credentialExtractor)
throws ResourceException {
             try {
                 String userName = credentialExtractor.getUserName();



Mime
View raw message