@InterfaceAudience.Private public class CachedClusterId extends Object
Modifier and Type | Field and Description |
---|---|
private AtomicInteger |
cacheMisses |
private ClusterId |
clusterId |
(package private) AtomicBoolean |
fetchInProgress |
private org.apache.hadoop.fs.FileSystem |
fs |
private AtomicBoolean |
isClusterIdSet |
static org.slf4j.Logger |
LOG |
private static int |
MAX_FETCH_TIMEOUT_MS |
private org.apache.hadoop.fs.Path |
rootDir |
private Server |
server |
Constructor and Description |
---|
CachedClusterId(Server server,
org.apache.hadoop.conf.Configuration conf) |
Modifier and Type | Method and Description |
---|---|
private boolean |
attemptFetch()
Attempts to fetch the cluster ID from the file system.
|
int |
getCacheStats() |
private String |
getClusterId()
Returns a cached copy of the cluster ID.
|
String |
getFromCacheOrFetch()
Fetches the ClusterId from FS if it is not cached locally.
|
private void |
setClusterId(ClusterId id)
Succeeds only once, when setting to a non-null value.
|
private void |
waitForFetchToFinish() |
public static final org.slf4j.Logger LOG
private static final int MAX_FETCH_TIMEOUT_MS
private final org.apache.hadoop.fs.Path rootDir
private final org.apache.hadoop.fs.FileSystem fs
AtomicBoolean fetchInProgress
private AtomicBoolean isClusterIdSet
private AtomicInteger cacheMisses
public CachedClusterId(Server server, org.apache.hadoop.conf.Configuration conf) throws IOException
IOException
private void setClusterId(ClusterId id)
private String getClusterId()
private boolean attemptFetch()
private void waitForFetchToFinish() throws InterruptedException
InterruptedException
public String getFromCacheOrFetch()
public int getCacheStats()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.