Package alluxio.master
Class AbstractLocalAlluxioCluster
- java.lang.Object
-
- alluxio.master.AbstractLocalAlluxioCluster
-
- Direct Known Subclasses:
LocalAlluxioCluster,MultiMasterLocalAlluxioCluster
@NotThreadSafe public abstract class AbstractLocalAlluxioCluster extends java.lang.ObjectLocal Alluxio cluster.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringmHostnameprotected alluxio.proxy.ProxyProcessmProxyProcessprotected java.lang.ThreadmProxyThreadprotected java.lang.StringmWorkDirectoryprotected java.util.List<alluxio.worker.WorkerProcess>mWorkersprotected java.util.List<java.lang.Thread>mWorkerThreads
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidformatAndRestartMasters()Stops the masters, formats them, and then restarts them.abstract alluxio.client.file.FileSystemgetClient()Returns aFileSystemclient.abstract alluxio.client.file.FileSystemgetClient(alluxio.client.file.FileSystemContext context)protected abstract LocalAlluxioMastergetLocalAlluxioMaster()alluxio.proxy.ProxyProcessgetProxyProcess()Gets the proxy process.abstract voidinitConfiguration(java.lang.String name)Creates a defaultConfigurationfor testing.booleanisStartedWorkers()protected voidreset()Resets the cluster to original state.protected voidresetClientPools()Resets the client pools to the original state.voidrestartMasters()Restarts the master(s).protected voidsetAlluxioWorkDirectory(java.lang.String name)Sets Alluxio work directory.protected voidsetHostname()Sets hostname.protected voidsetupTest()Sets up corresponding directories for tests.voidstart()Starts both master and a worker using the configurations in test conf respectively.protected abstract voidstartMasters()Configures and starts the master(s).protected voidstartProxy()Configures and starts the proxy.voidstartWorkers()Configures and starts the worker(s).voidstop()Stops both the alluxio and underfs service threads.voidstopFS()Stops the alluxio filesystem's service thread only.protected abstract voidstopMasters()Stops the masters.protected voidstopProxy()Stops the proxy.voidstopWorkers()Stops the workers.protected voidwaitForMasterServing()voidwaitForWorkersRegistered(int timeoutMs)Waits for all workers registered with master.
-
-
-
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.ExceptionStarts both master and a worker using the configurations in test conf respectively.- Throws:
java.lang.Exception
-
startMasters
protected abstract void startMasters() throws java.lang.ExceptionConfigures 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.TimeoutExceptionjava.lang.InterruptedException
-
restartMasters
public void restartMasters() throws java.lang.ExceptionRestarts the master(s).- Throws:
java.lang.Exception
-
startProxy
protected void startProxy() throws java.lang.ExceptionConfigures and starts the proxy.- Throws:
java.lang.Exception
-
startWorkers
public void startWorkers() throws java.lang.ExceptionConfigures and starts the worker(s).- Throws:
java.lang.Exception
-
setupTest
protected void setupTest() throws java.io.IOExceptionSets up corresponding directories for tests.- Throws:
java.io.IOException
-
stop
public void stop() throws java.lang.ExceptionStops both the alluxio and underfs service threads.- Throws:
java.lang.Exception
-
stopFS
public void stopFS() throws java.lang.ExceptionStops the alluxio filesystem's service thread only.- Throws:
java.lang.Exception
-
formatAndRestartMasters
public void formatAndRestartMasters() throws java.lang.ExceptionStops 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.ExceptionStops the masters.- Throws:
java.lang.Exception
-
stopProxy
protected void stopProxy() throws java.lang.ExceptionStops the proxy.- Throws:
java.lang.Exception
-
stopWorkers
public void stopWorkers() throws java.lang.ExceptionStops 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.IOExceptionCreates a defaultConfigurationfor testing.- Parameters:
name- the name of the test/cluster- Throws:
java.io.IOException
-
getClient
public abstract alluxio.client.file.FileSystem getClient() throws java.io.IOExceptionReturns aFileSystemclient.- Returns:
- a
FileSystemclient - 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
FileSystemclient, 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.IOExceptionWaits for all workers registered with master.- Parameters:
timeoutMs- the timeout to wait- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionjava.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
-
-