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
This commit is contained in:
Hairong Kuang 2010-04-08 21:13:58 +00:00
parent 4c062c79c3
commit fb154e3a03
2 changed files with 8 additions and 8 deletions

View File

@ -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

View File

@ -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();