Class DurationSpec.IntSecondsBound

java.lang.Object
org.apache.cassandra.config.DurationSpec
org.apache.cassandra.config.DurationSpec.IntSecondsBound
Enclosing class:
DurationSpec

public static final class DurationSpec.IntSecondsBound extends DurationSpec
Represents a duration used for Cassandra configuration. The bound is [0, Integer.MAX_VALUE) in seconds. If the user sets a different unit - we still validate that converted to seconds the quantity will not exceed that upper bound. (CASSANDRA-17571)
  • Constructor Details

    • IntSecondsBound

      public IntSecondsBound(String value)
      Creates a DurationSpec.IntSecondsBound of the specified amount. The bound is [0, Integer.MAX_VALUE) in seconds. The bound is [0, Integer.MAX_VALUE) in seconds.
      Parameters:
      value - the duration
    • IntSecondsBound

      public IntSecondsBound(long quantity, TimeUnit unit)
      Creates a DurationSpec.IntSecondsBound of the specified amount in the specified unit. The bound is [0, Integer.MAX_VALUE) in seconds.
      Parameters:
      quantity - where quantity shouldn't be bigger than Integer.MAX_VALUE - 1 in seconds
      unit - in which the provided quantity is
    • IntSecondsBound

      public IntSecondsBound(long seconds)
      Creates a DurationSpec.IntSecondsBound of the specified amount in seconds. The bound is [0, Integer.MAX_VALUE) in seconds.
      Parameters:
      seconds - where seconds shouldn't be bigger than Integer.MAX_VALUE-1
  • Method Details

    • inSecondsString

      public static DurationSpec.IntSecondsBound inSecondsString(String value)
      Creates a DurationSpec.IntSecondsBound of the specified amount in seconds, expressed either as the number of seconds without unit, or as a regular quantity with unit. Used in the Converters for a few parameters which changed only type, but not names The bound is [0, Integer.MAX_VALUE) in seconds.
      Parameters:
      value - where value shouldn't be bigger than Integer.MAX_VALUE-1 in seconds
    • toNanoseconds

      public int toNanoseconds()
      Returns this duration in the number of nanoseconds as an int
      Returns:
      this duration in number of nanoseconds or Integer.MAX_VALUE if the number of nanoseconds is too large.
    • toMilliseconds

      public int toMilliseconds()
      Returns this duration in number of milliseconds as an int
      Returns:
      this duration in number of milliseconds or Integer.MAX_VALUE if the number of milliseconds is too large.
    • toSeconds

      public int toSeconds()
      Returns this duration in number of seconds as an int
      Returns:
      this duration in number of seconds or Integer.MAX_VALUE if the number of seconds is too large.