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  
    • 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
      • waitForMasterServing

        protected void waitForMasterServing()
                                     throws java.util.concurrent.TimeoutException,
                                            java.lang.InterruptedException
        Throws:
        java.util.concurrent.TimeoutException
        java.lang.InterruptedException
      • restartMasters

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

        protected void startProxy()
                           throws java.lang.Exception
        Configures and starts the proxy.
        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 Configuration 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()
        Resets the client pools to the original state.
      • 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