Enum Class RecoveryStrategy

java.lang.Object
java.lang.Enum<RecoveryStrategy>
io.github.bucket4j.distributed.proxy.RecoveryStrategy
All Implemented Interfaces:
Serializable, Comparable<RecoveryStrategy>, Constable

public enum RecoveryStrategy extends Enum<RecoveryStrategy>
Specifies the reaction which should be applied in case of previously saved state of bucket has been lost.

The state of bucket can be lost by many reasons, for example:

  • Split-brain happen.
  • The bucket state was stored on single jvm node without replication strategy and this node was crashed.
  • Wrong cache configuration.
  • Pragmatically errors introduced by vendor.
  • Human mistake.
Each time when DefaultBucketProxy detects that bucket state is missed, it applies this strategy to react.
  • Enum Constant Details

    • RECONSTRUCT

      public static final RecoveryStrategy RECONSTRUCT
      Initialize bucket yet another time. Use this strategy if availability is more preferred than consistency.
    • THROW_BUCKET_NOT_FOUND_EXCEPTION

      public static final RecoveryStrategy THROW_BUCKET_NOT_FOUND_EXCEPTION
      Throw BucketNotFoundException. Use this strategy if consistency is more preferred than availability.
  • Method Details

    • values

      public static RecoveryStrategy[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static RecoveryStrategy valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null