public class ChaosMonkeyService
extends org.apache.hadoop.service.AbstractService
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
log |
| Constructor and Description |
|---|
ChaosMonkeyService(com.codahale.metrics.MetricRegistry metrics,
QueueAccess queues) |
| Modifier and Type | Method and Description |
|---|---|
void |
addTarget(String name,
ChaosTarget target,
long probability)
Add a target ...
|
boolean |
chaosCheck(long probability)
Check for callers to see if chaos should be triggered; shares the
same random number source as the rest of the monkey entries
|
RenewingAction<MonkeyPlayAction> |
getChaosAction(long delay,
long interval,
TimeUnit timeUnit)
Get the chaos action
|
int |
getTargetCount()
Get the number of targets in the list
|
void |
play()
Iterate through all the entries and invoke chaos on those wanted
|
int |
randomPercentage() |
boolean |
schedule(long delay,
long interval,
TimeUnit timeUnit)
Schedule the monkey
|
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, serviceInit, serviceStart, serviceStop, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStoppublic ChaosMonkeyService(com.codahale.metrics.MetricRegistry metrics,
QueueAccess queues)
public void addTarget(String name, ChaosTarget target, long probability)
probability > 0name - nametarget - chaos targetprobability - probabilitypublic int getTargetCount()
public void play()
public int randomPercentage()
public boolean chaosCheck(long probability)
probability - probabilitypublic boolean schedule(long delay,
long interval,
TimeUnit timeUnit)
delay - initial delaytimeUnit - time unitpublic RenewingAction<MonkeyPlayAction> getChaosAction(long delay, long interval, TimeUnit timeUnit)
delay - timeUnit - time unitCopyright © 2014–2015 The Apache Software Foundation. All rights reserved.