cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: r306575 - /cocoon/blocks/databases/trunk/java/org/apache/cocoon/transformation/SQLTransformer.java
Date Thu, 06 Oct 2005 10:19:32 GMT
Author: vgritsenko
Date: Thu Oct  6 03:19:25 2005
New Revision: 306575

URL: http://svn.apache.org/viewcvs?rev=306575&view=rev
Log:
don't wait if already made connectAttempts attempts

Modified:
    cocoon/blocks/databases/trunk/java/org/apache/cocoon/transformation/SQLTransformer.java

Modified: cocoon/blocks/databases/trunk/java/org/apache/cocoon/transformation/SQLTransformer.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/databases/trunk/java/org/apache/cocoon/transformation/SQLTransformer.java?rev=306575&r1=306574&r2=306575&view=diff
==============================================================================
--- cocoon/blocks/databases/trunk/java/org/apache/cocoon/transformation/SQLTransformer.java
(original)
+++ cocoon/blocks/databases/trunk/java/org/apache/cocoon/transformation/SQLTransformer.java
Thu Oct  6 03:19:25 2005
@@ -788,13 +788,22 @@
                 for (int i = 0; i < this.connectAttempts && result == null; i++)
{
                     try {
                         result = datasource.getConnection();
-                    } catch (Exception e) {
-                        final long waittime = this.connectWaittime;
-                        getLogger().debug("Unable to get connection; waiting " +
-                                          waittime + "ms to try again.");
-                        try {
-                            Thread.sleep(waittime);
-                        } catch (InterruptedException ignored) {
+                    } catch (SQLException e) {
+                        if (i < this.connectAttempts) {
+                            final long waittime = this.connectWaittime;
+                            // Log exception if debug enabled.
+                            if (getLogger().isDebugEnabled()) {
+                                getLogger().info("Unable to get connection; waiting " +
+                                                  waittime + "ms to try again.", e);
+                            } else {
+                                getLogger().info("Unable to get connection; waiting " +
+                                                  waittime + "ms to try again.");
+                            }
+                            try {
+                                Thread.sleep(waittime);
+                            } catch (InterruptedException ex) {
+                                /* ignored */
+                            }
                         }
                     }
                 }
@@ -1464,7 +1473,9 @@
                         } finally {
                             try {
                                 rs.close();
-                            } catch (SQLException ignored) { }
+                            } catch (SQLException e) {
+                                /* ignored */
+                            }
                         }
                         end((String) outParametersNames.get(counter));
                     }



Mime
View raw message