You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2006/12/07 01:29:30 UTC

svn commit: r483310 - in /geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound: GeronimoConnectionEventListener.java SinglePoolConnectionInterceptor.java

Author: djencks
Date: Wed Dec  6 16:29:29 2006
New Revision: 483310

URL: http://svn.apache.org/viewvc?view=rev&rev=483310
Log:
GERONIMO-2632 Only try to destroy a connection once as a result of a ConnectionError event.  Don't try to cleanup connections we're about to destroy

Modified:
    geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/GeronimoConnectionEventListener.java
    geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SinglePoolConnectionInterceptor.java

Modified: geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/GeronimoConnectionEventListener.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/GeronimoConnectionEventListener.java?view=diff&rev=483310&r1=483309&r2=483310
==============================================================================
--- geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/GeronimoConnectionEventListener.java (original)
+++ geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/GeronimoConnectionEventListener.java Wed Dec  6 16:29:29 2006
@@ -43,6 +43,7 @@
     private final ManagedConnectionInfo managedConnectionInfo;
     private final ConnectionInterceptor stack;
     private final List connectionInfos = new ArrayList();
+    private boolean errorOccurred = false;
 
     public GeronimoConnectionEventListener(
             final ConnectionInterceptor stack,
@@ -85,9 +86,13 @@
                     + connectionEvent.getSource());
         }
         log.warn("connectionErrorOccurred called with " + connectionEvent.getConnectionHandle(), connectionEvent.getException());
-        ConnectionInfo ci = new ConnectionInfo(managedConnectionInfo);
-        ci.setConnectionHandle(connectionEvent.getConnectionHandle());
-        stack.returnConnection(ci, ConnectionReturnAction.DESTROY);
+        boolean errorOccurred = this.errorOccurred;
+        this.errorOccurred = true;
+        if (!errorOccurred) {
+            ConnectionInfo ci = new ConnectionInfo(managedConnectionInfo);
+            ci.setConnectionHandle(connectionEvent.getConnectionHandle());
+            stack.returnConnection(ci, ConnectionReturnAction.DESTROY);
+        }
     }
 
     public void localTransactionStarted(ConnectionEvent event) {

Modified: geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SinglePoolConnectionInterceptor.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SinglePoolConnectionInterceptor.java?view=diff&rev=483310&r1=483309&r2=483310
==============================================================================
--- geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SinglePoolConnectionInterceptor.java (original)
+++ geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SinglePoolConnectionInterceptor.java Wed Dec  6 16:29:29 2006
@@ -132,10 +132,12 @@
     protected boolean internalReturn(ConnectionInfo connectionInfo, ConnectionReturnAction connectionReturnAction) {
         ManagedConnectionInfo mci = connectionInfo.getManagedConnectionInfo();
         ManagedConnection mc = mci.getManagedConnection();
-        try {
-            mc.cleanup();
-        } catch (ResourceException e) {
-            connectionReturnAction = ConnectionReturnAction.DESTROY;
+        if (connectionReturnAction == ConnectionReturnAction.RETURN_HANDLE) {
+            try {
+                mc.cleanup();
+            } catch (ResourceException e) {
+                connectionReturnAction = ConnectionReturnAction.DESTROY;
+            }
         }
         boolean wasInPool = false;
         synchronized (pool) {