DefaultChaosPolicy
Default implementation of the chaos policy.
Behaviour (in order):
If ChaosConfig.latency is not
null, suspends for that duration.If ChaosConfig.failureRate
> 0, rolls a random double; if< failureRate, throws the configured ChaosConfig.exception (defaults toRuntimeException("Chaos fault injected")).If ChaosConfig.injectResult is set and no fault fired, executes the block (for side-effects), discards its result, and returns ChaosConfig.injectResult instead.
Otherwise executes the block normally and returns its result.
When ChaosConfig.enabled is false, this policy must NOT be installed — the resilient builder handles this guard and will not instantiate DefaultChaosPolicy for disabled configs.
Parameters
The ChaosConfig driving this policy's behaviour.