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

    Constructors
    Constructor
    Description
    Create a new service to refresh mount table cache when there is change in mount table entries.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
     
    protected RouterClient
    createRouterClient(InetSocketAddress routerSocket, org.apache.hadoop.conf.Configuration config)
     
    getLocalRefresher(String adminAddress)
     
    void
    Refresh mount table cache of this router as well as all other routers.
    protected void
    serviceInit(org.apache.hadoop.conf.Configuration conf)
     
    protected void
     
    protected void
     

    Methods 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • MountTableRefresherService

      public MountTableRefresherService(Router router)
      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

      protected void serviceInit(org.apache.hadoop.conf.Configuration conf) throws Exception
      Overrides:
      serviceInit in class org.apache.hadoop.service.AbstractService
      Throws:
      Exception
    • closeRouterClient

      @VisibleForTesting protected void closeRouterClient(RouterClient client)
    • createRouterClient

      @VisibleForTesting protected RouterClient createRouterClient(InetSocketAddress routerSocket, org.apache.hadoop.conf.Configuration config) throws IOException
      Throws:
      IOException
    • serviceStart

      protected void serviceStart() throws Exception
      Overrides:
      serviceStart in class org.apache.hadoop.service.AbstractService
      Throws:
      Exception
    • serviceStop

      protected void serviceStop() throws Exception
      Overrides:
      serviceStop in class org.apache.hadoop.service.AbstractService
      Throws:
      Exception
    • refresh

      public void refresh() throws StateStoreUnavailableException
      Refresh mount table cache of this router as well as all other routers.
      Throws:
      StateStoreUnavailableException - if the state store is not available.
    • getLocalRefresher

      @VisibleForTesting protected MountTableRefresherThread getLocalRefresher(String adminAddress)