Sorry, but my previous post spoiling the attachment.

El 07/08/10 13:37, dariof escribió:
> Attached goes a candidate patch that almost solve the premature exit
> of getConnection() method.
> Use it as sees fit.
>
> regards,
> Dario.

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: h2database-read-only/h2/src/main/org/h2/jdbcx
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: JdbcConnectionPool.java
--- JdbcConnectionPool.java Remotely Modified (Based On HEAD)
+++ JdbcConnectionPool.java Locally Modified (Based On LOCAL)
@@ -194,14 +194,12 @@
      *      or a timeout occurred
      */
     public Connection getConnection() throws SQLException {
-        for (int i = 0;; i++) {
+        final long exittime = System.currentTimeMillis()+ (timeout*1000L);
+        while  (exittime > System.currentTimeMillis()) {
             synchronized (this) {
                 if (activeConnections < maxConnections) {
                     return getConnectionNow();
                 }
-                if (i >= timeout) {
-                    throw new SQLException("Login timeout", "08001", 8001);
-                }
                 try {
                     wait(1000);
                 } catch (InterruptedException e) {
@@ -209,6 +207,7 @@
                 }
             }
         }
+        throw new SQLException("Login timeout", "08001", 8001);
     }
 
     private Connection getConnectionNow() throws SQLException {

Reply via email to