@ThreadSafe
public final class MultiProcessCluster
extends java.lang.Object
implements org.junit.rules.TestRule
LocalAlluxioCluster, MultiProcessCluster is
- Slower
- Black box testing only (No access to master/worker internals)
- Destructible (You can kill -9 masters/workers)
- More realistic of real deployments
Due to the slower speed, [@link LocalAlluxioCluster} should generally be preferred.
MultiProcessCluster is primarily for tests which want to stop or restart servers.
The synchronization strategy for this class is to synchronize all public methods.| Modifier and Type | Class and Description |
|---|---|
static class |
MultiProcessCluster.Builder
Builder for
MultiProcessCluster. |
static class |
MultiProcessCluster.DeployMode
Deploy mode for the cluster.
|
| Modifier and Type | Method and Description |
|---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description) |
void |
destroy()
Destroys the cluster.
|
FileSystem |
getFileSystemClient() |
java.util.List<MasterNetAddress> |
getMasterAddresses() |
static MultiProcessCluster.Builder |
newBuilder() |
void |
notifySuccess()
Informs the cluster that the test succeeded.
|
void |
restartZk()
Restarts the Zookeeper cluster.
|
void |
saveWorkdir()
Copies the work directory to the artifacts folder.
|
void |
start()
Starts the cluster, launching all server processes.
|
void |
startMaster(int i)
Starts the specified master.
|
void |
startWorker(int i)
Starts the specified worker.
|
void |
stopMaster(int i) |
void |
stopWorker(int i) |
void |
stopZk()
Stops the Zookeeper cluster.
|
int |
waitForAndKillPrimaryMaster(int timeoutMs)
Kills the primary master.
|
public void start()
throws java.lang.Exception
java.lang.Exceptionpublic int waitForAndKillPrimaryMaster(int timeoutMs)
timeoutMs - maximum amount of time to wait, in millisecondspublic FileSystem getFileSystemClient()
public void notifySuccess()
public void saveWorkdir()
throws java.io.IOException
java.io.IOExceptionpublic void destroy()
throws java.io.IOException
java.io.IOExceptionpublic void startMaster(int i)
throws java.io.IOException
i - the index of the master to startjava.io.IOExceptionpublic void startWorker(int i)
throws java.io.IOException
i - the index of the worker to startjava.io.IOExceptionpublic void stopMaster(int i)
throws java.io.IOException
i - the index of the master to stopjava.io.IOExceptionpublic void stopWorker(int i)
throws java.io.IOException
i - the index of the worker to stopjava.io.IOExceptionpublic java.util.List<MasterNetAddress> getMasterAddresses()
public void stopZk()
throws java.io.IOException
java.io.IOExceptionpublic void restartZk()
throws java.lang.Exception
java.lang.Exceptionpublic org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description)
apply in interface org.junit.rules.TestRulepublic static MultiProcessCluster.Builder newBuilder()
MultiProcessClusterCopyright © 2018. All Rights Reserved.