geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ke...@apache.org
Subject svn commit: r514956 - in /geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound: ./ connectionmanagerconfig/
Date Tue, 06 Mar 2007 02:07:18 GMT
Author: kevan
Date: Mon Mar  5 18:07:17 2007
New Revision: 514956

URL: http://svn.apache.org/viewvc?view=rev&rev=514956
Log:
GERONIMO-2838 Fix transaction recovery errors. A few changes from the last go-round. One,
derby configuration problems have been fixed. Also, in AbstractConnectionManager we now insure
that we're using the correct ManagedConnectionInfo. Also added additional logging in MCFConnectionInterceptor
to capture failure information.

Modified:
    geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/AbstractConnectionManager.java
    geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/GenericConnectionManager.java
    geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/MCFConnectionInterceptor.java
    geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/LocalTransactions.java
    geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/NoTransactions.java
    geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/TransactionLog.java
    geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/TransactionSupport.java
    geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/XATransactions.java

Modified: geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/AbstractConnectionManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/AbstractConnectionManager.java?view=diff&rev=514956&r1=514955&r2=514956
==============================================================================
--- geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/AbstractConnectionManager.java
(original)
+++ geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/AbstractConnectionManager.java
Mon Mar  5 18:07:17 2007
@@ -88,13 +88,17 @@
 
     public ConnectionManagerContainer.ReturnableXAResource getRecoveryXAResource(ManagedConnectionFactory
managedConnectionFactory) throws ResourceException {
         ManagedConnectionInfo mci = new ManagedConnectionInfo(managedConnectionFactory, null);
-        NamedXAResource namedXAResource = (NamedXAResource) mci.getXAResource();
-        if (namedXAResource == null) {
-            //obviously, we can't do recovery.
+
+        // if we aren't recoverable, then there's nothing to do...
+        if (!getIsRecoverable()) {
             return null;
         }
+        
         ConnectionInfo recoveryConnectionInfo = new ConnectionInfo(mci);
         getRecoveryStack().getConnection(recoveryConnectionInfo);
+
+        // For pooled resources, we may now have a new MCI (not the one constructed above).
Make sure we use the correct MCI
+        NamedXAResource namedXAResource = (NamedXAResource) recoveryConnectionInfo.getManagedConnectionInfo().getXAResource();
         return new ConnectionManagerContainer.ReturnableXAResource(namedXAResource, getRecoveryStack(),
recoveryConnectionInfo);
     }
 
@@ -152,6 +156,10 @@
         return interceptors.getRecoveryStack();
     }
 
+    private boolean getIsRecoverable() {
+        return interceptors.getRecoveryStack() != null;
+    }
+
     //public for persistence of pooling attributes (max, min size, blocking/idle timeouts)
     public PoolingSupport getPooling() {
         return interceptors.getPoolingAttributes();
@@ -161,7 +169,7 @@
         ConnectionInterceptor getStack();
 
         ConnectionInterceptor getRecoveryStack();
-
+        
         PoolingSupport getPoolingAttributes();
     }
 

Modified: geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/GenericConnectionManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/GenericConnectionManager.java?view=diff&rev=514956&r1=514955&r2=514956
==============================================================================
--- geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/GenericConnectionManager.java
(original)
+++ geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/GenericConnectionManager.java
Mon Mar  5 18:07:17 2007
@@ -98,9 +98,12 @@
                 stack = new SubjectInterceptor(stack);
             }
 
-            ConnectionInterceptor recoveryStack = stack;
-            this.recoveryStack = new TCCLInterceptor(recoveryStack, classLoader);
-
+            if (transactionSupport.isRecoverable()) {
+        	this.recoveryStack = new TCCLInterceptor(stack, classLoader);
+            } else {
+        	this.recoveryStack = null;
+            }
+            
 
             stack = new ConnectionHandleInterceptor(stack);
             stack = new TCCLInterceptor(stack, classLoader);
@@ -120,10 +123,11 @@
         public ConnectionInterceptor getRecoveryStack() {
             return recoveryStack;
         }
-
+        
         public PoolingSupport getPoolingAttributes() {
             return poolingSupport;
         }
+
     }
 
 }

Modified: geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/MCFConnectionInterceptor.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/MCFConnectionInterceptor.java?view=diff&rev=514956&r1=514955&r2=514956
==============================================================================
--- geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/MCFConnectionInterceptor.java
(original)
+++ geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/MCFConnectionInterceptor.java
Mon Mar  5 18:07:17 2007
@@ -20,6 +20,9 @@
 import javax.resource.ResourceException;
 import javax.resource.spi.ManagedConnection;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 /**
  * MCFConnectionInterceptor.java
  *
@@ -28,6 +31,8 @@
  */
 public class MCFConnectionInterceptor implements ConnectionInterceptor {
 
+    protected static final Log log = LogFactory.getLog(MCFConnectionInterceptor.class.getName());
+
     private ConnectionInterceptor stack;
 
     public MCFConnectionInterceptor() {
@@ -38,14 +43,20 @@
         if (mci.getManagedConnection() != null) {
             return;
         }
-        ManagedConnection mc =
+        
+        try {
+            ManagedConnection mc =
                 mci.getManagedConnectionFactory().createManagedConnection(
                         mci.getSubject(),
                         mci.getConnectionRequestInfo());
-        mci.setManagedConnection(mc);
-        GeronimoConnectionEventListener listener = new GeronimoConnectionEventListener(stack,
mci);
-        mci.setConnectionEventListener(listener);
-        mc.addConnectionEventListener(listener);
+            mci.setManagedConnection(mc);
+            GeronimoConnectionEventListener listener = new GeronimoConnectionEventListener(stack,
mci);
+            mci.setConnectionEventListener(listener);
+            mc.addConnectionEventListener(listener);
+        } catch (ResourceException re) {
+            log.error("Error occurred creating ManagedConnection for " + connectionInfo,
re);
+            throw re;
+        }
     }
 
     public void returnConnection(

Modified: geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/LocalTransactions.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/LocalTransactions.java?view=diff&rev=514956&r1=514955&r2=514956
==============================================================================
--- geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/LocalTransactions.java
(original)
+++ geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/LocalTransactions.java
Mon Mar  5 18:07:17 2007
@@ -44,4 +44,8 @@
         stack = new TransactionEnlistingInterceptor(stack, transactionManager);
         return new TransactionCachingInterceptor(stack, transactionManager);
     }
+    
+    public boolean isRecoverable() {
+        return false;
+    }
 }

Modified: geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/NoTransactions.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/NoTransactions.java?view=diff&rev=514956&r1=514955&r2=514956
==============================================================================
--- geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/NoTransactions.java
(original)
+++ geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/NoTransactions.java
Mon Mar  5 18:07:17 2007
@@ -40,4 +40,8 @@
     public ConnectionInterceptor addTransactionInterceptors(ConnectionInterceptor stack,
TransactionManager transactionManager) {
         return stack;
     }
+    
+    public boolean isRecoverable() {
+        return false;
+    }
 }

Modified: geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/TransactionLog.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/TransactionLog.java?view=diff&rev=514956&r1=514955&r2=514956
==============================================================================
--- geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/TransactionLog.java
(original)
+++ geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/TransactionLog.java
Mon Mar  5 18:07:17 2007
@@ -45,4 +45,8 @@
         stack = new TransactionEnlistingInterceptor(stack, transactionManager);
         return new TransactionCachingInterceptor(stack, transactionManager);
     }
+    
+    public boolean isRecoverable() {
+        return false;
+    }
 }

Modified: geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/TransactionSupport.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/TransactionSupport.java?view=diff&rev=514956&r1=514955&r2=514956
==============================================================================
--- geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/TransactionSupport.java
(original)
+++ geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/TransactionSupport.java
Mon Mar  5 18:07:17 2007
@@ -32,5 +32,5 @@
 public abstract class TransactionSupport implements Serializable {
     public abstract ConnectionInterceptor addXAResourceInsertionInterceptor(ConnectionInterceptor
stack, String name);
     public abstract ConnectionInterceptor addTransactionInterceptors(ConnectionInterceptor
stack, TransactionManager transactionManager);
-
+    public abstract boolean isRecoverable();
 }

Modified: geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/XATransactions.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/XATransactions.java?view=diff&rev=514956&r1=514955&r2=514956
==============================================================================
--- geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/XATransactions.java
(original)
+++ geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/XATransactions.java
Mon Mar  5 18:07:17 2007
@@ -32,6 +32,7 @@
  *
  * */
 public class XATransactions extends TransactionSupport {
+    
     private boolean useTransactionCaching;
     private boolean useThreadCaching;
 
@@ -71,5 +72,9 @@
             stack = new TransactionCachingInterceptor(stack, transactionManager);
         }
         return stack;
+    }
+    
+    public boolean isRecoverable() {
+        return true;
     }
 }



Mime
View raw message