From fb154e3a032d99ad535cbb749fe3ee126347e102 Mon Sep 17 00:00:00 2001 From: Hairong Kuang Date: Thu, 8 Apr 2010 21:13:58 +0000 Subject: [PATCH] HADOOP-6691. TestFileSystemCaching sometimes hangs. Contributed by Hairong Kuang. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@932115 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 ++ .../apache/hadoop/fs/TestFileSystemCaching.java | 14 ++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 8df0dbcaa6..26c95ae7e5 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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 diff --git a/src/test/core/org/apache/hadoop/fs/TestFileSystemCaching.java b/src/test/core/org/apache/hadoop/fs/TestFileSystemCaching.java index 1fb66f583a..b860282fa3 100644 --- a/src/test/core/org/apache/hadoop/fs/TestFileSystemCaching.java +++ b/src/test/core/org/apache/hadoop/fs/TestFileSystemCaching.java @@ -30,9 +30,9 @@ 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 void testCacheEnabled() throws Exception { } 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 void run() { }; 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();