harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r504147 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/InetAddress.java
Date Tue, 06 Feb 2007 14:19:14 GMT
Author: tellison
Date: Tue Feb  6 06:19:13 2007
New Revision: 504147

URL: http://svn.apache.org/viewvc?view=rev&rev=504147
Log:
Apply patch HARMONY-2973 ([classlib] [luni] Concerns about synchronization in java.net.InetAddress)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/InetAddress.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/InetAddress.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/InetAddress.java?view=diff&rev=504147&r1=504146&r2=504147
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/InetAddress.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/InetAddress.java Tue
Feb  6 06:19:13 2007
@@ -841,6 +841,16 @@
                         }
                     }
                 }
+
+                synchronized (waitReachable) {
+                    addrCount--;
+
+                    if (addrCount == 0) {
+                        // if count equals zero, all thread
+                        // expired,notifies main thread
+                        waitReachable.notifyAll();
+                    }
+                }
                 continue;
             }
 
@@ -884,8 +894,10 @@
         if (needWait) {
             synchronized (waitReachable) {
                 try {
-                    // wait for notification
-                    waitReachable.wait();
+                    while (!reached && (addrCount != 0)) {
+                        // wait for notification
+                        waitReachable.wait(1000);
+                    }
                 } catch (InterruptedException e) {
                     // do nothing
                 }



Mime
View raw message