Author: hairong Date: Thu Apr 8 21:13:58 2010 New Revision: 932115 URL: http://svn.apache.org/viewvc?rev=932115&view=rev Log: HADOOP-6691. TestFileSystemCaching sometimes hangs. Contributed by Hairong Kuang.
Modified: hadoop/common/trunk/CHANGES.txt hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestFileSystemCaching.java Modified: hadoop/common/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/trunk/CHANGES.txt?rev=932115&r1=932114&r2=932115&view=diff ============================================================================== --- hadoop/common/trunk/CHANGES.txt (original) +++ hadoop/common/trunk/CHANGES.txt Thu Apr 8 21:13:58 2010 @@ -312,6 +312,8 @@ Trunk (unreleased changes) HADOOP-6680. hadoop-cloud push command invokes proxy creation. (Andrew Klochkov via tomwhite) + HADOOP-6691. TestFileSystemCaching sometimes hangs. (hairong) + Release 0.21.0 - Unreleased INCOMPATIBLE CHANGES Modified: hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestFileSystemCaching.java URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestFileSystemCaching.java?rev=932115&r1=932114&r2=932115&view=diff ============================================================================== --- hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestFileSystemCaching.java (original) +++ hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestFileSystemCaching.java Thu Apr 8 21:13:58 2010 @@ -30,9 +30,9 @@ import org.apache.hadoop.security.UserGr import org.apache.hadoop.security.token.Token; import org.apache.hadoop.security.token.TokenIdentifier; import org.junit.Test; -import java.security.PrivilegedAction; -import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; +import java.util.concurrent.Semaphore; + import static org.mockito.Mockito.mock; @@ -49,11 +49,10 @@ public class TestFileSystemCaching { } public static class InitializeForeverFileSystem extends LocalFileSystem { + final static Semaphore sem = new Semaphore(0); public void initialize(URI uri, Configuration conf) throws IOException { // notify that InitializeForeverFileSystem started initialization - synchronized (conf) { - conf.notify(); - } + sem.release(); try { while (true) { Thread.sleep(1000); @@ -82,9 +81,8 @@ public class TestFileSystemCaching { }; t.start(); // wait for InitializeForeverFileSystem to start initialization - synchronized (conf) { - conf.wait(); - } + InitializeForeverFileSystem.sem.acquire(); + conf.set("fs.cachedfile.impl", conf.get("fs.file.impl")); FileSystem.get(new URI("cachedfile://a"), conf); t.interrupt();