Class NetworkDisruption.NetworkDelay
java.lang.Object
org.elasticsearch.test.disruption.NetworkDisruption.NetworkLinkDisruptionType
org.elasticsearch.test.disruption.NetworkDisruption.NetworkDelay
- Enclosing class:
- NetworkDisruption
public static class NetworkDisruption.NetworkDelay extends NetworkDisruption.NetworkLinkDisruptionType
Simulates slow or congested network. Delivery of requests that are sent from source to target node are delayed by a configurable
time amount.
-
Field Summary
Fields Modifier and Type Field Description static org.elasticsearch.common.unit.TimeValue
DEFAULT_DELAY_MAX
static org.elasticsearch.common.unit.TimeValue
DEFAULT_DELAY_MIN
-
Constructor Summary
Constructors Constructor Description NetworkDelay(org.elasticsearch.common.unit.TimeValue delay)
Delays requests by a fixed time value. -
Method Summary
Modifier and Type Method Description void
applyDisruption(MockTransportService sourceTransportService, MockTransportService targetTransportService)
Applies network disruption for requests send from the node represented by the source transport service to the node represented by the target transport service.org.elasticsearch.common.unit.TimeValue
expectedTimeToHeal()
Returns expected time to heal after disruption has been removed.static NetworkDisruption.NetworkDelay
random(java.util.Random random)
Delays requests by a random but fixed time value betweenDEFAULT_DELAY_MIN
andDEFAULT_DELAY_MAX
.static NetworkDisruption.NetworkDelay
random(java.util.Random random, org.elasticsearch.common.unit.TimeValue delayMin, org.elasticsearch.common.unit.TimeValue delayMax)
Delays requests by a random but fixed time value between delayMin and delayMax.java.lang.String
toString()
Methods inherited from class org.elasticsearch.test.disruption.NetworkDisruption.NetworkLinkDisruptionType
removeDisruption
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
DEFAULT_DELAY_MIN
public static org.elasticsearch.common.unit.TimeValue DEFAULT_DELAY_MIN -
DEFAULT_DELAY_MAX
public static org.elasticsearch.common.unit.TimeValue DEFAULT_DELAY_MAX
-
-
Constructor Details
-
NetworkDelay
public NetworkDelay(org.elasticsearch.common.unit.TimeValue delay)Delays requests by a fixed time value.- Parameters:
delay
- time to delay requests
-
-
Method Details
-
random
Delays requests by a random but fixed time value betweenDEFAULT_DELAY_MIN
andDEFAULT_DELAY_MAX
.- Parameters:
random
- instance to use for randomization of delay
-
random
public static NetworkDisruption.NetworkDelay random(java.util.Random random, org.elasticsearch.common.unit.TimeValue delayMin, org.elasticsearch.common.unit.TimeValue delayMax)Delays requests by a random but fixed time value between delayMin and delayMax.- Parameters:
random
- instance to use for randomization of delaydelayMin
- minimum delaydelayMax
- maximum delay
-
applyDisruption
public void applyDisruption(MockTransportService sourceTransportService, MockTransportService targetTransportService)Description copied from class:NetworkDisruption.NetworkLinkDisruptionType
Applies network disruption for requests send from the node represented by the source transport service to the node represented by the target transport service.- Specified by:
applyDisruption
in classNetworkDisruption.NetworkLinkDisruptionType
- Parameters:
sourceTransportService
- source transport service from which requests are senttargetTransportService
- target transport service to which requests are sent
-
expectedTimeToHeal
public org.elasticsearch.common.unit.TimeValue expectedTimeToHeal()Description copied from class:NetworkDisruption.NetworkLinkDisruptionType
Returns expected time to heal after disruption has been removed. Defaults to instant healing.- Overrides:
expectedTimeToHeal
in classNetworkDisruption.NetworkLinkDisruptionType
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-