Class RandomLossGenerator

java.lang.Object
io.aeron.driver.ext.RandomLossGenerator
All Implemented Interfaces:
LossGenerator

public class RandomLossGenerator extends Object implements LossGenerator
Uniform random loss generator which can be used for testing loss scenarios.
  • 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

      public boolean shouldDropFrame(InetSocketAddress address, UnsafeBuffer buffer, int length)
      Should a frame be dropped?
      Specified by:
      shouldDropFrame in interface LossGenerator
      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