CycleDetectingLockFactory.Policies
Date: 2016-05-24

com.google.common.util.concurrent

## Enum CycleDetectingLockFactory.Policies

- java.lang.Object
- - java.lang.Enum<CycleDetectingLockFactory.Policies>
  - - com.google.common.util.concurrent.CycleDetectingLockFactory.Policies

- All Implemented Interfaces:
    CycleDetectingLockFactory.Policy, java.io.Serializable, java.lang.Comparable<CycleDetectingLockFactory.Policies>
  Enclosing class:
    CycleDetectingLockFactory

      @Beta
      public static enum CycleDetectingLockFactory.Policies
      extends java.lang.Enum<CycleDetectingLockFactory.Policies>
      implements CycleDetectingLockFactory.Policy

  Pre-defined `CycleDetectingLockFactory.Policy` implementations.
  Since:
    13.0

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `DISABLED` Disables cycle detection.
    `THROW` When potential deadlock is detected, this policy results in the throwing of the `PotentialDeadlockException` indicating the potential deadlock, which includes stack traces illustrating the cycle in lock acquisition order.
    `WARN` When potential deadlock is detected, this policy results in the logging of a `Level.SEVERE` message indicating the potential deadlock, which includes stack traces illustrating the cycle in lock acquisition order.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static CycleDetectingLockFactory.Policies` | `valueOf(java.lang.String name)` Returns the enum constant of this type with the specified name.
    `static CycleDetectingLockFactory.Policies[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

    - ### Methods inherited from class java.lang.Enum

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface com.google.common.util.concurrent.CycleDetectingLockFactory.Policy

      `handlePotentialDeadlock`

- - ### Enum Constant Detail

    - #### THROW

          public static final CycleDetectingLockFactory.Policies THROW

      When potential deadlock is detected, this policy results in the throwing of the `PotentialDeadlockException` indicating the potential deadlock, which includes stack traces illustrating the cycle in lock acquisition order.

    - #### WARN

          public static final CycleDetectingLockFactory.Policies WARN

      When potential deadlock is detected, this policy results in the logging of a `Level.SEVERE` message indicating the potential deadlock, which includes stack traces illustrating the cycle in lock acquisition order.

    - #### DISABLED

          public static final CycleDetectingLockFactory.Policies DISABLED

      Disables cycle detection. This option causes the factory to return unmodified lock implementations provided by the JDK, and is provided to allow applications to easily parameterize when cycle detection is enabled.

      Note that locks created by a factory with this policy will not participate the cycle detection performed by locks created by other factories.

  - ### Method Detail

    - #### values

          public static CycleDetectingLockFactory.Policies[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (CycleDetectingLockFactory.Policies c : CycleDetectingLockFactory.Policies.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static CycleDetectingLockFactory.Policies valueOf(java.lang.String name)

      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
        `java.lang.IllegalArgumentException` - if this enum type has no constant with the specified name
        `java.lang.NullPointerException` - if the argument is null