Enum Class LockMode
- All Implemented Interfaces:
Serializable
,Comparable<LockMode>
,Constable
Various lock modes for use within transactions. Except
for
UNSAFE
, all modes follow the same policy when modifying
entries. They all differ with respect to entries which are being read.
When an entry is modified, an exclusive lock is acquired, which is typically held until the end of the transaction. When transaction scopes are committed, all held locks transfer to the parent scope. Uncommitted scopes release all of their acquired locks.
Modes ordered from strongest to weakest:
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionLock mode which acquires shared locks when reading entries and releases them as soon as possible.Lock mode which never acquires locks when reading entries.Lock mode which acquires shared locks when reading entries and retains them to the end of the transaction or scope.Lock mode which never acquires locks.Lock mode which acquires upgradable locks when reading entries and retains them to the end of the transaction or scope. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns true if acquired locks are retained for the duration of the transaction.static LockMode
Returns the enum constant of this class with the specified name.static LockMode[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
UPGRADABLE_READ
Lock mode which acquires upgradable locks when reading entries and retains them to the end of the transaction or scope. If an entry guarded by an upgradable lock is modified, the lock is first upgraded to be exclusive. -
REPEATABLE_READ
Lock mode which acquires shared locks when reading entries and retains them to the end of the transaction or scope. Attempting to modify entries guarded by a shared lock isillegal
. Consider usingUPGRADABLE_READ
instead.- See Also:
-
READ_COMMITTED
Lock mode which acquires shared locks when reading entries and releases them as soon as possible. -
READ_UNCOMMITTED
Lock mode which never acquires locks when reading entries. Modifications made by concurrent transactions are visible for reading, but they might get rolled back. -
UNSAFE
Lock mode which never acquires locks. This mode bypasses all transactional safety, permitting modifications even when locked by other transactions. These modifications are immediately committed, and so rollback is not possible.
-
-
Method Details
-
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
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 nameNullPointerException
- if the argument is null
-
isRepeatable
public boolean isRepeatable()Returns true if acquired locks are retained for the duration of the transaction. Applicable toUPGRADABLE_READ
andREPEATABLE_READ
.
-