YARN-10562. Follow up changes for YARN-9833. Contributed by Jim Brennan.
(cherry picked from commit 768e2f42ba
)
This commit is contained in:
parent
a093bd859d
commit
d79f705a30
|
@ -22,6 +22,7 @@ import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -29,7 +30,6 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||||
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
|
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
|
||||||
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
||||||
|
@ -239,9 +239,9 @@ public class DirectoryCollection {
|
||||||
throw new YarnRuntimeException(e);
|
throw new YarnRuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
localDirs = new CopyOnWriteArrayList<>(dirs);
|
localDirs = new ArrayList<>(Arrays.asList(dirs));
|
||||||
errorDirs = new CopyOnWriteArrayList<>();
|
errorDirs = new ArrayList<>();
|
||||||
fullDirs = new CopyOnWriteArrayList<>();
|
fullDirs = new ArrayList<>();
|
||||||
directoryErrorInfo = new ConcurrentHashMap<>();
|
directoryErrorInfo = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
|
ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
|
||||||
|
@ -287,7 +287,7 @@ public class DirectoryCollection {
|
||||||
List<String> getFailedDirs() {
|
List<String> getFailedDirs() {
|
||||||
this.readLock.lock();
|
this.readLock.lock();
|
||||||
try {
|
try {
|
||||||
return ImmutableList.copyOf(
|
return Collections.unmodifiableList(
|
||||||
DirectoryCollection.concat(errorDirs, fullDirs));
|
DirectoryCollection.concat(errorDirs, fullDirs));
|
||||||
} finally {
|
} finally {
|
||||||
this.readLock.unlock();
|
this.readLock.unlock();
|
||||||
|
@ -315,7 +315,7 @@ public class DirectoryCollection {
|
||||||
List<String> getErroredDirs() {
|
List<String> getErroredDirs() {
|
||||||
this.readLock.lock();
|
this.readLock.lock();
|
||||||
try {
|
try {
|
||||||
return Collections.unmodifiableList(errorDirs);
|
return ImmutableList.copyOf(errorDirs);
|
||||||
} finally {
|
} finally {
|
||||||
this.readLock.unlock();
|
this.readLock.unlock();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue