Enum IsolationLevels
- java.lang.Object
-
- java.lang.Enum<IsolationLevels>
-
- org.eclipse.rdf4j.common.transaction.IsolationLevels
-
- All Implemented Interfaces:
Serializable
,Comparable<IsolationLevels>
,IsolationLevel
,TransactionSetting
public enum IsolationLevels extends Enum<IsolationLevels> implements IsolationLevel
Enumeration of TransactionIsolationLevel
s supported by RDF4J. Note that RDF4J stores are not required to support all levels, consult the documentatation for the specific SAIL implementation you are using to find out which levels are supported.- Author:
- Jeen Broekstra, James Leigh
-
-
Enum Constant Summary
Enum Constants Enum Constant Description NONE
None: the lowest isolation level; transactions can see their own changes, but may not be able to roll them back and no support for isolation among transactions is guaranteedREAD_COMMITTED
Read Committed: in this isolation level only statements from other transactions that have been committed (at some point) can be seen by this transaction.READ_UNCOMMITTED
Read Uncommitted: transactions can be rolled back, but not necessarily isolated: concurrent transactions might see each other's uncommitted data (so-called 'dirty reads')SERIALIZABLE
Serializable: in addition toSNAPSHOT
, this isolation level requires that all other successful transactions must appear to occur either completely before or completely after a successful serializable transaction.SNAPSHOT
Snapshot: in addition toSNAPSHOT_READ
, successful transactions in this isolation level will operate against a particular dataset snapshot.SNAPSHOT_READ
Snapshot Read: in addition toREAD_COMMITTED
, query results in this isolation level that are observed within a successful transaction will observe a consistent snapshot.
-
Field Summary
-
Fields inherited from interface org.eclipse.rdf4j.common.transaction.IsolationLevel
NAME
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static IsolationLevel
getCompatibleIsolationLevel(IsolationLevel level, List<? extends IsolationLevel> supportedLevels)
Determines the first compatible isolation level in the list of supported levels, for the given level.boolean
isCompatibleWith(IsolationLevel otherLevel)
Verifies if this transaction isolation level is compatible with the supplied other isolation level - that is, if this transaction isolation level offers at least the same guarantees as the other level.static IsolationLevels
valueOf(String name)
Returns the enum constant of this type with the specified name.static IsolationLevels[]
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 interface org.eclipse.rdf4j.common.transaction.IsolationLevel
getName, getValue
-
-
-
-
Enum Constant Detail
-
NONE
public static final IsolationLevels NONE
None: the lowest isolation level; transactions can see their own changes, but may not be able to roll them back and no support for isolation among transactions is guaranteed
-
READ_UNCOMMITTED
public static final IsolationLevels READ_UNCOMMITTED
Read Uncommitted: transactions can be rolled back, but not necessarily isolated: concurrent transactions might see each other's uncommitted data (so-called 'dirty reads')
-
READ_COMMITTED
public static final IsolationLevels READ_COMMITTED
Read Committed: in this isolation level only statements from other transactions that have been committed (at some point) can be seen by this transaction.
-
SNAPSHOT_READ
public static final IsolationLevels SNAPSHOT_READ
Snapshot Read: in addition toREAD_COMMITTED
, query results in this isolation level that are observed within a successful transaction will observe a consistent snapshot. Changes to the data occurring while a query is evaluated will not affect that query result.
-
SNAPSHOT
public static final IsolationLevels SNAPSHOT
Snapshot: in addition toSNAPSHOT_READ
, successful transactions in this isolation level will operate against a particular dataset snapshot. Transactions in this isolation level will see either the complete effects of other transactions (consistently throughout) or not at all.
-
SERIALIZABLE
public static final IsolationLevels SERIALIZABLE
Serializable: in addition toSNAPSHOT
, this isolation level requires that all other successful transactions must appear to occur either completely before or completely after a successful serializable transaction.
-
-
Method Detail
-
values
public static IsolationLevels[] 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 (IsolationLevels c : IsolationLevels.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static IsolationLevels 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
-
isCompatibleWith
public boolean isCompatibleWith(IsolationLevel otherLevel)
Description copied from interface:IsolationLevel
Verifies if this transaction isolation level is compatible with the supplied other isolation level - that is, if this transaction isolation level offers at least the same guarantees as the other level. By definition, every transaction isolation level is compatible with itself.- Specified by:
isCompatibleWith
in interfaceIsolationLevel
- Parameters:
otherLevel
- an other isolation level to check compatibility against.- Returns:
- true iff this isolation level is compatible with the supplied other isolation level, false otherwise.
-
getCompatibleIsolationLevel
public static IsolationLevel getCompatibleIsolationLevel(IsolationLevel level, List<? extends IsolationLevel> supportedLevels)
Determines the first compatible isolation level in the list of supported levels, for the given level. Returns the level itself if it is in the list of supported levels. Returns null if no compatible level can be found.- Parameters:
level
- theIsolationLevel
for which to determine a compatible level.supportedLevels
- a list of supported isolation levels from which to select the closest compatible level.- Returns:
- the given level if it occurs in the list of supported levels. Otherwise, the first compatible level in
the list of supported isolation levels, or
null
if no compatible level can be found. - Throws:
IllegalArgumentException
- if either one of the input parameters isnull
.
-
-