Repository: tomee
Updated Branches:
  refs/heads/tomee-1.7.x 8c427379f -> 553b0fd56


Revert "Use connection key + transaction to store connection in registry"

This reverts commit efff429ace2bc59a7586e604bd123f2f217627c5.


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/be54eed2
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/be54eed2
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/be54eed2

Branch: refs/heads/tomee-1.7.x
Commit: be54eed210c00dd0d17bb609062f18c63a5c0adc
Parents: 8c42737
Author: Jonathan Gallimore <[email protected]>
Authored: Thu Jul 30 13:45:43 2015 +0100
Committer: Jonathan Gallimore <[email protected]>
Committed: Thu Jul 30 13:45:43 2015 +0100

----------------------------------------------------------------------
 .../jdbc/managed/local/ManagedConnection.java   | 49 +-------------------
 1 file changed, 2 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/be54eed2/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/managed/local/ManagedConnection.java
----------------------------------------------------------------------
diff --git 
a/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/managed/local/ManagedConnection.java
 
b/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/managed/local/ManagedConnection.java
index eb52d05..859e445 100644
--- 
a/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/managed/local/ManagedConnection.java
+++ 
b/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/managed/local/ManagedConnection.java
@@ -26,7 +26,6 @@ import java.lang.reflect.Method;
 import java.sql.Connection;
 import java.sql.SQLException;
 import java.sql.Wrapper;
-
 import javax.sql.CommonDataSource;
 import javax.sql.DataSource;
 import javax.sql.XAConnection;
@@ -113,14 +112,12 @@ public class ManagedConnection implements 
InvocationHandler {
 
             // get the already bound connection to the current transaction or 
enlist this one in the tx
             if (isUnderTransaction(transaction.getStatus())) {
-                final TxRegistryKey txRegistryKey = new TxRegistryKey(key, 
transaction);
-                
-                Connection connection = 
Connection.class.cast(registry.getResource(txRegistryKey));
+                Connection connection = 
Connection.class.cast(registry.getResource(transaction));
                 if (connection == null && delegate == null) {
                     newConnection();
                     connection = delegate;
 
-                    registry.putResource(txRegistryKey, delegate);
+                    registry.putResource(transaction, delegate);
                     currentTransaction = transaction;
                     try {
                         transaction.enlistResource(getXAResource());
@@ -287,46 +284,4 @@ public class ManagedConnection implements 
InvocationHandler {
             return hash;
         }
     }
-    
-    private static final class TxRegistryKey {
-        private final Key key;
-        private final Transaction tx;
-        
-        private TxRegistryKey(Key key, Transaction tx) {
-            super();
-            this.key = key;
-            this.tx = tx;
-        }
-
-        public Key getKey() {
-            return key;
-        }
-
-        public Transaction getTx() {
-            return tx;
-        }
-
-        @Override
-        public int hashCode() {
-            final int prime = 31;
-            int result = 1;
-            result = prime * result + ((key == null) ? 0 : key.hashCode());
-            result = prime * result + ((tx == null) ? 0 : tx.hashCode());
-            return result;
-        }
-
-        @Override
-        public boolean equals(final Object o) {
-            if (this == o) {
-                return true;
-            }
-            if (o == null || getClass() != o.getClass()) {
-                return false;
-            }
-
-            final TxRegistryKey txRegKey = TxRegistryKey.class.cast(o);
-            return (this.key == txRegKey.key || this.key.equals(txRegKey.key)) 
&&
-                    !(this.tx != null ? !this.tx.equals(txRegKey.tx) : 
txRegKey.tx != null);
-        }
-    }
 }

Reply via email to