harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r1035945 - in /harmony/enhanced/java/branches/java6: ./ classlib/ classlib/depends/libs/ classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/io/FileCanonPathCache.java drlvm/ jdktools/
Date Wed, 17 Nov 2010 08:08:33 GMT
Author: hindessm
Date: Wed Nov 17 08:08:33 2010
New Revision: 1035945

URL: http://svn.apache.org/viewvc?rev=1035945&view=rev
Log:
Merge change from /harmony/enhanced/java/trunk@1035930:

  r1035930 | regisxu | 2010-11-17 06:44:11 +0000 (Wed, 17 Nov 2010) | 5 lines
  
  Fix for HARMONY-6675: Reducing timeout value in CanonicalPatchCache to fix a file not found
error in Hadoop common
  
  1. make timeout of CanonicalPatchCache configurable via property
     'org.apache.harmony.file.canonical.path.cache.timeout'.
  2. reduce default timeout value to 30 seconds.

Modified:
    harmony/enhanced/java/branches/java6/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/depends/libs/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/io/FileCanonPathCache.java
    harmony/enhanced/java/branches/java6/drlvm/   (props changed)
    harmony/enhanced/java/branches/java6/jdktools/   (props changed)

Propchange: harmony/enhanced/java/branches/java6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 17 08:08:33 2010
@@ -1,4 +1,4 @@
 /harmony/enhanced/java/branches/mrh:935751-941490
-/harmony/enhanced/java/trunk:929253-1029636,1029773,1029853,1030005,1033407
+/harmony/enhanced/java/trunk:929253-1029636,1029773,1029853,1030005,1033407,1035930
 /harmony/enhanced/trunk:476395-929252
 /incubator/harmony/enhanced/trunk:292550-476394

Propchange: harmony/enhanced/java/branches/java6/classlib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 17 08:08:33 2010
@@ -1,7 +1,7 @@
 /harmony/enhanced/classlib/trunk:713674-735919,765923-926091,926318-926838
 /harmony/enhanced/classlib/trunk/working_classlib:884014-884286
 /harmony/enhanced/java/branches/mrh/classlib:935751-941490
-/harmony/enhanced/java/trunk/classlib:929253-1029636,1029773,1029853,1030005,1033407
+/harmony/enhanced/java/trunk/classlib:929253-1029636,1029773,1029853,1030005,1033407,1035930
 /harmony/enhanced/trunk/classlib:476395-929252
 /harmony/enhanced/trunk/working_classlib:476396-920147
 /incubator/harmony/enhanced/trunk/classlib:292550-476394

Propchange: harmony/enhanced/java/branches/java6/classlib/depends/libs/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 17 08:08:33 2010
@@ -1,4 +1,4 @@
 /harmony/enhanced/classlib/trunk/depends/libs:544451-926091
-/harmony/enhanced/java/trunk/classlib/depends/libs:929253-1029636,1029773,1029853,1030005,1033407
+/harmony/enhanced/java/trunk/classlib/depends/libs:929253-1029636,1029773,1029853,1030005,1033407,1035930
 /harmony/enhanced/trunk/classlib/depends/libs:476395-929252
 /incubator/harmony/enhanced/trunk/classlib/depends/libs:292550-476394

Modified: harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/io/FileCanonPathCache.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/io/FileCanonPathCache.java?rev=1035945&r1=1035944&r2=1035945&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/io/FileCanonPathCache.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/io/FileCanonPathCache.java
Wed Nov 17 08:08:33 2010
@@ -55,9 +55,29 @@ public class FileCanonPathCache {
     private static Object lock = new Object();
 
     /**
-     * Expired time.
+     * Expired time, 0 disable this cache.
      */
-    private static long timeout = 600000;
+    private static long timeout = 30000;
+
+    /**
+     * Whether to enable this cache.
+     */
+    private static boolean isEnable = true;
+
+    public static final String FILE_CANONICAL_PATH_CACHE_TIMEOUT = "org.apache.harmony.file.canonical.path.cache.timeout";
+
+    static {
+        String value = System.getProperty(FILE_CANONICAL_PATH_CACHE_TIMEOUT);
+        try {
+            timeout = Long.parseLong(value);
+        } catch (NumberFormatException e) {
+            // use default timeout value
+        }
+
+        if (timeout <= 0) {
+            isEnable = false;
+        }
+    }
 
     /**
      * Retrieve element from cache.
@@ -68,6 +88,10 @@ public class FileCanonPathCache {
      * 
      */
     public static String get(String path) {
+        if (!isEnable) {
+            return null;
+        }
+
         CacheElement element = null;
         synchronized (lock) {
             element = cache.get(path);
@@ -104,6 +128,10 @@ public class FileCanonPathCache {
      *            the canonical path of <code>path</code>.
      */
     public static void put(String path, String canonicalPath) {
+        if (!isEnable) {
+            return;
+        }
+
         CacheElement element = new CacheElement(canonicalPath);
         synchronized (lock) {
             if (cache.size() >= CACHE_SIZE) {
@@ -120,6 +148,10 @@ public class FileCanonPathCache {
      * Remove all elements from cache.
      */
     public static void clear() {
+        if (!isEnable) {
+            return;
+        }
+
         synchronized (lock) {
             cache.clear();
             list.clear();
@@ -132,5 +164,9 @@ public class FileCanonPathCache {
 
     public static void setTimeout(long timeout) {
         FileCanonPathCache.timeout = timeout;
+        if (timeout <= 0) {
+            clear();
+            isEnable = false;
+        }
     }
 }

Propchange: harmony/enhanced/java/branches/java6/drlvm/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 17 08:08:33 2010
@@ -1,5 +1,5 @@
 /harmony/enhanced/java/branches/mrh/drlvm:935751-941490
-/harmony/enhanced/java/trunk/drlvm:929253-1029636,1029773,1029853,1030005,1033407
+/harmony/enhanced/java/trunk/drlvm:929253-1029636,1029773,1029853,1030005,1033407,1035930
 /harmony/enhanced/trunk/drlvm:476395-929252
 /harmony/enhanced/trunk/working_vm:476396-920147
 /incubator/harmony/enhanced/trunk/drlvm:292550-476394

Propchange: harmony/enhanced/java/branches/java6/jdktools/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 17 08:08:33 2010
@@ -1,4 +1,4 @@
-/harmony/enhanced/java/trunk/jdktools:929253-1029636,1029773,1029853,1030005,1033407
+/harmony/enhanced/java/trunk/jdktools:929253-1029636,1029773,1029853,1030005,1033407,1035930
 /harmony/enhanced/jdktools/trunk:630107-925933
 /harmony/enhanced/trunk/jdktools:476395-929252
 /harmony/enhanced/trunk/working_jdktools:476396-920147



Mime
View raw message