Package org.hibernate.cache.spi.access
Enum AccessType
- java.lang.Object
-
- java.lang.Enum<AccessType>
-
- org.hibernate.cache.spi.access.AccessType
-
- All Implemented Interfaces:
Serializable
,Comparable<AccessType>
public enum AccessType extends Enum<AccessType>
Enumerates the policies for managing concurrent access to the shared second-level cache.- API Note:
- This enumeration is isomorphic to
CacheConcurrencyStrategy
. We don't really need both, but one is part of this SPI, and one forms part of the API of the annotations package. In the future, it would be nice to replace them both with a neworg.hibernate.CacheConcurrencyPolicy
enum.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description NONSTRICT_READ_WRITE
Read and write access.READ_ONLY
Read-only access.READ_WRITE
Read and write access.TRANSACTIONAL
Read and write access.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AccessType
fromExternalName(String externalName)
Resolve anAccessType
from its external name.String
getExternalName()
Get the external name of this value.String
toString()
static AccessType
valueOf(String name)
Returns the enum constant of this type with the specified name.static AccessType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
READ_ONLY
public static final AccessType READ_ONLY
Read-only access. Data may be added and removed, but not mutated.
-
READ_WRITE
public static final AccessType READ_WRITE
Read and write access. Data may be added, removed and mutated. A "soft" lock on the cached item is used to manage concurrent access during mutation.
-
NONSTRICT_READ_WRITE
public static final AccessType NONSTRICT_READ_WRITE
Read and write access. Data may be added, removed and mutated. The cached item is invalidated before and after transaction completion to manage concurrent access during mutation. This strategy is more vulnerable to inconsistencies thanREAD_WRITE
, but may allow higher throughput.
-
TRANSACTIONAL
public static final AccessType TRANSACTIONAL
Read and write access. Data may be added, removed and mutated. Some sort of hard lock is maintained in conjunction with a JTA transaction.
-
-
Method Detail
-
values
public static AccessType[] 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 (AccessType c : AccessType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static AccessType valueOf(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:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getExternalName
public String getExternalName()
Get the external name of this value.- Returns:
- The corresponding externalized name.
-
toString
public String toString()
- Overrides:
toString
in classEnum<AccessType>
-
fromExternalName
public static AccessType fromExternalName(String externalName)
Resolve anAccessType
from its external name.- Parameters:
externalName
- The external representation to resolve- Returns:
- The
AccessType
represented by the given external name - Throws:
UnknownAccessTypeException
- if the external name was not recognized- See Also:
getExternalName()
-
-