Enum Class PutMethod

java.lang.Object
java.lang.Enum<PutMethod>
io.datarouter.storage.config.PutMethod
All Implemented Interfaces:
Serializable, Comparable<PutMethod>, Constable

public enum PutMethod extends Enum<PutMethod>
Defines the strategy used when writing a databean to a datastore, especially the behavior when trying to put a databean which has a key that already exists.
  • Enum Constant Details

    • SELECT_FIRST_OR_LOOK_AT_PRIMARY_KEY

      public static final PutMethod SELECT_FIRST_OR_LOOK_AT_PRIMARY_KEY
      Get the primary key first to determine whether to update or insert. Slow, and may not be thread safe.
    • UPDATE_OR_INSERT

      public static final PutMethod UPDATE_OR_INSERT
      Try to update, and in case of failure, issue an insert. Good to use when rows are usually there.
    • INSERT_OR_UPDATE

      public static final PutMethod INSERT_OR_UPDATE
      Try to insert, and in case of failure, issue an update.
    • INSERT_OR_BUST

      public static final PutMethod INSERT_OR_BUST
      Try to insert the databean, and throw an exception if the primary key already exists.
    • UPDATE_OR_BUST

      public static final PutMethod UPDATE_OR_BUST
      Try to update the row at this primary key, and throw an exception if the primary key does not exist.
    • MERGE

      public static final PutMethod MERGE
    • INSERT_IGNORE

      public static final PutMethod INSERT_IGNORE
      Try to insert the databean and ignore any error that may come up. If the key already exists, or any other error happens, silently abort the put.
    • INSERT_ON_DUPLICATE_UPDATE

      public static final PutMethod INSERT_ON_DUPLICATE_UPDATE
      Try to insert, or update all the non-key fields if the key already exists. Performs the put as a single operation if the datastore supports it. This is the default.
    • UPDATE_IGNORE

      public static final PutMethod UPDATE_IGNORE
      Try to update the databean and ignore any error that may come up, like if the primary key does not exist.
  • Field Details

    • METHODS_TO_FLUSH_IMMEDIATELY

      public static final Set<PutMethod> METHODS_TO_FLUSH_IMMEDIATELY
    • DEFAULT_PUT_METHOD

      public static final PutMethod DEFAULT_PUT_METHOD
  • Method Details

    • values

      public static PutMethod[] 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 PutMethod 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
    • getShouldAutoCommit

      public boolean getShouldAutoCommit()