Class CacheReplicationMonitor
java.lang.Object
java.lang.Thread
org.apache.hadoop.util.concurrent.SubjectInheritingThread
org.apache.hadoop.hdfs.server.blockmanagement.CacheReplicationMonitor
- All Implemented Interfaces:
Closeable,AutoCloseable,Runnable
@LimitedPrivate("HDFS")
public class CacheReplicationMonitor
extends org.apache.hadoop.util.concurrent.SubjectInheritingThread
implements Closeable
Scans the namesystem, scheduling blocks to be cached as appropriate.
The CacheReplicationMonitor does a full scan when the NameNode first
starts up, and at configurable intervals afterwards.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionCacheReplicationMonitor(FSNamesystem namesystem, CacheManager cacheManager, long intervalMs, ReentrantLock lock) -
Method Summary
Methods inherited from class org.apache.hadoop.util.concurrent.SubjectInheritingThread
run, startMethods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, suspend, toString, yield
-
Constructor Details
-
CacheReplicationMonitor
public CacheReplicationMonitor(FSNamesystem namesystem, CacheManager cacheManager, long intervalMs, ReentrantLock lock)
-
-
Method Details
-
work
public void work()- Overrides:
workin classorg.apache.hadoop.util.concurrent.SubjectInheritingThread
-
waitForRescanIfNeeded
public void waitForRescanIfNeeded()Waits for a rescan to complete. This doesn't guarantee consistency with pending operations, only relative recency, since it will not force a new rescan if a rescan is already underway.Note that this call will release the FSN lock, so operations before and after are not atomic.
-
setNeedsRescan
public void setNeedsRescan()Indicates to the CacheReplicationMonitor that there have been CacheManager changes that require a rescan. -
close
Shut down the monitor thread.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-