public class PolicyBasedChaosMonkey extends ChaosMonkey
| Modifier and Type | Field and Description |
|---|---|
static long |
TIMEOUT |
| Constructor and Description |
|---|
PolicyBasedChaosMonkey(IntegrationTestingUtility util,
Collection<Policy> policies) |
PolicyBasedChaosMonkey(IntegrationTestingUtility util,
Policy... policies)
Construct a new ChaosMonkey
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isDestructive()
Returns whether the CM does destructive actions (killing servers) so that a cluster restore
is needed after CM is stopped.
|
boolean |
isStopped() |
static <T> T |
selectRandomItem(T[] items)
Selects a random item from the given items
|
static <T> List<T> |
selectRandomItems(T[] items,
float ratio)
Selects and returns ceil(ratio * items.length) random items from the given array
|
static <T> T |
selectWeightedRandomItem(List<Pair<T,Integer>> items)
Selects a random item from the given items with weights
|
void |
start() |
void |
stop(String why)
Stop this service.
|
void |
waitForStop()
Wait for ChaosMonkey to stop.
|
public static final long TIMEOUT
public PolicyBasedChaosMonkey(IntegrationTestingUtility util, Policy... policies)
util - the HBaseIntegrationTestingUtility already configuredpolicies - custom policies to usepublic PolicyBasedChaosMonkey(IntegrationTestingUtility util, Collection<Policy> policies)
public static <T> T selectRandomItem(T[] items)
public static <T> T selectWeightedRandomItem(List<Pair<T,Integer>> items)
public static <T> List<T> selectRandomItems(T[] items, float ratio)
public void start()
throws Exception
start in class ChaosMonkeyExceptionpublic void stop(String why)
Stoppablestop in interface Stoppablestop in class ChaosMonkeywhy - Why we're stopping.public boolean isStopped()
isStopped in interface StoppableisStopped in class ChaosMonkeyStoppable.stop(String) has been closed.public void waitForStop()
throws InterruptedException
waitForStop in class ChaosMonkeyInterruptedExceptionpublic boolean isDestructive()
ChaosMonkeyisDestructive in class ChaosMonkey