Package io.aeron.driver.ext
Class RandomLossGenerator
java.lang.Object
io.aeron.driver.ext.RandomLossGenerator
- All Implemented Interfaces:
LossGenerator
Uniform random loss generator which can be used for testing loss scenarios.
-
Constructor Summary
ConstructorsConstructorDescriptionRandomLossGenerator(double lossRate) Construct loss generator with given loss rate as percentage.RandomLossGenerator(double lossRate, long lossSeed) Construct loss generator with given loss rate as percentage and random seed. -
Method Summary
Modifier and TypeMethodDescriptionbooleanshouldDropFrame(InetSocketAddress address, UnsafeBuffer buffer, int length) Should a frame be dropped?Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.aeron.driver.ext.LossGenerator
shouldDropFrame
-
Constructor Details
-
RandomLossGenerator
public RandomLossGenerator(double lossRate) Construct loss generator with given loss rate as percentage.- Parameters:
lossRate- for generating loss.
-
RandomLossGenerator
public RandomLossGenerator(double lossRate, long lossSeed) Construct loss generator with given loss rate as percentage and random seed.- Parameters:
lossRate- for generating loss.lossSeed- for random seeding.
-
-
Method Details
-
shouldDropFrame
Should a frame be dropped?- Specified by:
shouldDropFramein interfaceLossGenerator- Parameters:
address- The source address of the frame if inbound or the remote address if outbound.buffer- The buffer containing the frame data.length- The length of the frame.- Returns:
- true to drop, false to process
-