db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1501196 - /db/derby/code/branches/10.10/java/engine/org/apache/derby/jdbc/Driver20.java
Date Tue, 09 Jul 2013 10:50:23 GMT
Author: kahatlen
Date: Tue Jul  9 10:50:23 2013
New Revision: 1501196

URL: http://svn.apache.org/r1501196
Log:
DERBY-6167: Interrupt restarts clock for login timeout

Backported revision 1500585 from trunk.

Modified:
    db/derby/code/branches/10.10/java/engine/org/apache/derby/jdbc/Driver20.java

Modified: db/derby/code/branches/10.10/java/engine/org/apache/derby/jdbc/Driver20.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/engine/org/apache/derby/jdbc/Driver20.java?rev=1501196&r1=1501195&r2=1501196&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/engine/org/apache/derby/jdbc/Driver20.java (original)
+++ db/derby/code/branches/10.10/java/engine/org/apache/derby/jdbc/Driver20.java Tue Jul 
9 10:50:23 2013
@@ -260,16 +260,16 @@ public abstract class Driver20 extends I
         try {
             LoginCallable callable = new LoginCallable( this, url, info );
             Future<EmbedConnection>  task = _executorPool.submit( callable );
-            long startTime = System.currentTimeMillis();
-            long interruptedTime = startTime;
+            long now = System.currentTimeMillis();
+            long giveUp = now + loginTimeoutSeconds * 1000L;
             
-            while ((startTime - interruptedTime) / 1000.0 < loginTimeoutSeconds) {
+            while (now < giveUp) {
                 try {
-                    return task.get( loginTimeoutSeconds, TimeUnit.SECONDS );
+                    return task.get(giveUp - now, TimeUnit.MILLISECONDS);
                 }
                 catch (InterruptedException ie) {
-                    interruptedTime = System.currentTimeMillis();
                     InterruptStatus.setInterrupted();
+                    now = System.currentTimeMillis();
                     continue;
                 }
                 catch (ExecutionException ee) { throw processException( ee ); }



Mime
View raw message