public class PolicyBasedChaosMonkey extends ChaosMonkey
Modifier and Type | Field and Description |
---|---|
(package private) Properties |
monkeyProps |
private ExecutorService |
monkeyThreadPool |
private static long |
ONE_MIN |
private static long |
ONE_SEC |
private Policy[] |
policies |
static long |
TIMEOUT |
(package private) IntegrationTestingUtility |
util |
Constructor and Description |
---|
PolicyBasedChaosMonkey(IntegrationTestingUtility util,
Collection<Policy> policies) |
PolicyBasedChaosMonkey(IntegrationTestingUtility util,
Policy... policies)
Construct a new ChaosMonkey
|
PolicyBasedChaosMonkey(Properties monkeyProps,
IntegrationTestingUtility util,
Collection<Policy> policies) |
PolicyBasedChaosMonkey(Properties monkeyProps,
IntegrationTestingUtility util,
Policy... policies) |
Modifier and Type | Method and Description |
---|---|
private static ExecutorService |
buildMonkeyThreadPool(int size) |
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<org.apache.hadoop.hbase.util.Pair<T,Integer>> items)
Selects a random item from the given items with weights
|
void |
start() |
void |
stop(String why) |
void |
waitForStop() |
private static final long ONE_SEC
private static final long ONE_MIN
public static final long TIMEOUT
final IntegrationTestingUtility util
final Properties monkeyProps
private final ExecutorService monkeyThreadPool
public PolicyBasedChaosMonkey(IntegrationTestingUtility util, Policy... policies)
util
- the HBaseIntegrationTestingUtility already configuredpolicies
- custom policies to usepublic PolicyBasedChaosMonkey(IntegrationTestingUtility util, Collection<Policy> policies)
public PolicyBasedChaosMonkey(Properties monkeyProps, IntegrationTestingUtility util, Collection<Policy> policies)
public PolicyBasedChaosMonkey(Properties monkeyProps, IntegrationTestingUtility util, Policy... policies)
private static ExecutorService buildMonkeyThreadPool(int size)
public static <T> T selectRandomItem(T[] items)
public static <T> T selectWeightedRandomItem(List<org.apache.hadoop.hbase.util.Pair<T,Integer>> items)
public static <T> List<T> selectRandomItems(T[] items, float ratio)
public void start() throws Exception
start
in class ChaosMonkey
Exception
public void stop(String why)
stop
in interface org.apache.hadoop.hbase.Stoppable
stop
in class ChaosMonkey
public boolean isStopped()
isStopped
in interface org.apache.hadoop.hbase.Stoppable
isStopped
in class ChaosMonkey
public void waitForStop() throws InterruptedException
waitForStop
in class ChaosMonkey
InterruptedException
public boolean isDestructive()
ChaosMonkey
isDestructive
in class ChaosMonkey
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.