Class MountTableRefresherService
java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.hdfs.server.federation.router.MountTableRefresherService
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.service.Service
public class MountTableRefresherService
extends org.apache.hadoop.service.AbstractService
This service is invoked from
MountTableStore when there is change in
mount table entries and it updates mount table entry cache on local router as
well as on all remote routers. Refresh on local router is done by calling
CachedRecordStore.loadCache(boolean)} API directly, no RPC call
involved, but on remote routers refresh is done through RouterClient(RPC
call). To improve performance, all routers are refreshed in separate thread
and all connection are cached. Cached connections are removed from
cache and closed when their max live time is elapsed.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE -
Constructor Summary
ConstructorsConstructorDescriptionMountTableRefresherService(Router router) Create a new service to refresh mount table cache when there is change in mount table entries. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcloseRouterClient(RouterClient client) protected RouterClientcreateRouterClient(InetSocketAddress routerSocket, org.apache.hadoop.conf.Configuration config) protected MountTableRefresherThreadgetLocalRefresher(String adminAddress) voidrefresh()Refresh mount table cache of this router as well as all other routers.protected voidserviceInit(org.apache.hadoop.conf.Configuration conf) protected voidprotected voidMethods inherited from class org.apache.hadoop.service.AbstractService
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
-
Constructor Details
-
MountTableRefresherService
Create a new service to refresh mount table cache when there is change in mount table entries.- Parameters:
router- whose mount table cache will be refreshed
-
-
Method Details
-
serviceInit
- Overrides:
serviceInitin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
closeRouterClient
-
createRouterClient
@VisibleForTesting protected RouterClient createRouterClient(InetSocketAddress routerSocket, org.apache.hadoop.conf.Configuration config) throws IOException - Throws:
IOException
-
serviceStart
- Overrides:
serviceStartin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
serviceStop
- Overrides:
serviceStopin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
refresh
Refresh mount table cache of this router as well as all other routers.- Throws:
StateStoreUnavailableException- if the state store is not available.
-
getLocalRefresher
-