Class AbstractLocalAlluxioCluster

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String mHostname  
      protected alluxio.proxy.ProxyProcess mProxyProcess  
      protected java.lang.Thread mProxyThread  
      protected java.lang.String mWorkDirectory  
      protected java.util.List<alluxio.worker.WorkerProcess> mWorkers  
      protected java.util.List<java.lang.Thread> mWorkerThreads  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void formatAndRestartMasters()
      Stops the masters, formats them, and then restarts them.
      abstract alluxio.client.file.FileSystem getClient()
      Returns a FileSystem client.
      abstract alluxio.client.file.FileSystem getClient​(alluxio.client.file.FileSystemContext context)  
      protected abstract LocalAlluxioMaster getLocalAlluxioMaster()  
      alluxio.proxy.ProxyProcess getProxyProcess()
      Gets the proxy process.
      abstract void initConfiguration​(java.lang.String name)
      Creates a default ServerConfiguration for testing.
      boolean isStartedWorkers()  
      protected void reset()
      Resets the cluster to original state.
      protected void resetClientPools()
      Resets the client pools to the original state.
      void restartMasters()
      Restarts the master(s).
      protected void setAlluxioWorkDirectory​(java.lang.String name)
      Sets Alluxio work directory.
      protected void setHostname()
      Sets hostname.
      protected void setupTest()
      Sets up corresponding directories for tests.
      void start()
      Starts both master and a worker using the configurations in test conf respectively.
      protected abstract void startMasters()
      Configures and starts the master(s).
      void startWorkers()
      Configures and starts the worker(s).
      void stop()
      Stops both the alluxio and underfs service threads.
      void stopFS()
      Stops the alluxio filesystem's service thread only.
      protected abstract void stopMasters()
      Stops the masters.
      protected void stopProxy()
      Stops the proxy.
      void stopWorkers()
      Stops the workers.
      void waitForWorkersRegistered​(int timeoutMs)
      Waits for all workers registered with master.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • mProxyProcess

        protected alluxio.proxy.ProxyProcess mProxyProcess
      • mProxyThread

        protected java.lang.Thread mProxyThread
      • mWorkers

        protected java.util.List<alluxio.worker.WorkerProcess> mWorkers
      • mWorkerThreads

        protected java.util.List<java.lang.Thread> mWorkerThreads
      • mWorkDirectory

        protected java.lang.String mWorkDirectory
      • mHostname

        protected java.lang.String mHostname
    • Method Detail

      • start

        public void start()
                   throws java.lang.Exception
        Starts both master and a worker using the configurations in test conf respectively.
        Throws:
        java.lang.Exception
      • startMasters

        protected abstract void startMasters()
                                      throws java.lang.Exception
        Configures and starts the master(s).
        Throws:
        java.lang.Exception
      • restartMasters

        public void restartMasters()
                            throws java.lang.Exception
        Restarts the master(s).
        Throws:
        java.lang.Exception
      • startWorkers

        public void startWorkers()
                          throws java.lang.Exception
        Configures and starts the worker(s).
        Throws:
        java.lang.Exception
      • setupTest

        protected void setupTest()
                          throws java.io.IOException
        Sets up corresponding directories for tests.
        Throws:
        java.io.IOException
      • stop

        public void stop()
                  throws java.lang.Exception
        Stops both the alluxio and underfs service threads.
        Throws:
        java.lang.Exception
      • stopFS

        public void stopFS()
                    throws java.lang.Exception
        Stops the alluxio filesystem's service thread only.
        Throws:
        java.lang.Exception
      • formatAndRestartMasters

        public void formatAndRestartMasters()
                                     throws java.lang.Exception
        Stops the masters, formats them, and then restarts them. This is useful if a fresh state is desired, for example when restoring from a backup.
        Throws:
        java.lang.Exception
      • stopMasters

        protected abstract void stopMasters()
                                     throws java.lang.Exception
        Stops the masters.
        Throws:
        java.lang.Exception
      • stopProxy

        protected void stopProxy()
                          throws java.lang.Exception
        Stops the proxy.
        Throws:
        java.lang.Exception
      • stopWorkers

        public void stopWorkers()
                         throws java.lang.Exception
        Stops the workers.
        Throws:
        java.lang.Exception
      • isStartedWorkers

        public boolean isStartedWorkers()
        Returns:
        true if the workers are started, and not stopped
      • initConfiguration

        public abstract void initConfiguration​(java.lang.String name)
                                        throws java.io.IOException
        Creates a default ServerConfiguration for testing.
        Parameters:
        name - the name of the test/cluster
        Throws:
        java.io.IOException
      • getClient

        public abstract alluxio.client.file.FileSystem getClient()
                                                          throws java.io.IOException
        Returns a FileSystem client.
        Returns:
        a FileSystem client
        Throws:
        java.io.IOException
      • getClient

        public abstract alluxio.client.file.FileSystem getClient​(alluxio.client.file.FileSystemContext context)
                                                          throws java.io.IOException
        Parameters:
        context - the FileSystemContext to use
        Returns:
        a FileSystem client, using a specific context
        Throws:
        java.io.IOException
      • getLocalAlluxioMaster

        protected abstract LocalAlluxioMaster getLocalAlluxioMaster()
        Returns:
        the local Alluxio master
      • getProxyProcess

        public alluxio.proxy.ProxyProcess getProxyProcess()
        Gets the proxy process.
        Returns:
        the proxy
      • waitForWorkersRegistered

        public void waitForWorkersRegistered​(int timeoutMs)
                                      throws java.util.concurrent.TimeoutException,
                                             java.lang.InterruptedException,
                                             java.io.IOException
        Waits for all workers registered with master.
        Parameters:
        timeoutMs - the timeout to wait
        Throws:
        java.util.concurrent.TimeoutException
        java.lang.InterruptedException
        java.io.IOException
      • reset

        protected void reset()
        Resets the cluster to original state.
      • resetClientPools

        protected void resetClientPools()
                                 throws java.io.IOException
        Resets the client pools to the original state.
        Throws:
        java.io.IOException
      • setHostname

        protected void setHostname()
        Sets hostname.
      • setAlluxioWorkDirectory

        protected void setAlluxioWorkDirectory​(java.lang.String name)
        Sets Alluxio work directory.
        Parameters:
        name - the name of the test/cluster