Package com.unboundid.util
Enum ThreadSafetyLevel
- All Implemented Interfaces:
Serializable,Comparable<ThreadSafetyLevel>,java.lang.constant.Constable
This enumeration defines a set of thread safety levels that may be used to
indicate whether the associated code is safe to be accessed concurrently
by multiple threads.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe associated code is completely threadsafe and may be accessed concurrently by any number of threads, subject to the constraints described in theThreadSafetydocumentation.Methods declared in the associated interface or abstract class are not required to be threadsafe and classes which call them must not rely on the ability to concurrently invoke those methods on the same object instance without any external synchronization.Methods declared in the associated interface or abstract class must be threadsafe in classes which implement that interface or extend that abstract class.The associated method may not be considered threadsafe and should not be invoked concurrently by multiple threads.The associated method may be considered threadsafe and may be invoked concurrently by multiple threads, subject to the constraints described in theThreadSafetydocumentation, and in any additional notes contained in the method-level javadoc.The associated code is mostly not threadsafe, but there may be some methods which are safe to be invoked concurrently by multiple threads.The associated code is mostly threadsafe, but there may be some methods which are not safe to be invoked when multiple threads are accessing an instance concurrently.The associated code is not threadsafe. -
Method Summary
Modifier and TypeMethodDescriptionstatic ThreadSafetyLevelRetrieves the thread safety level with the specified name.static ThreadSafetyLevelReturns the enum constant of this type with the specified name.static ThreadSafetyLevel[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
COMPLETELY_THREADSAFE
The associated code is completely threadsafe and may be accessed concurrently by any number of threads, subject to the constraints described in theThreadSafetydocumentation. -
MOSTLY_THREADSAFE
The associated code is mostly threadsafe, but there may be some methods which are not safe to be invoked when multiple threads are accessing an instance concurrently. The class-level documentation for a class including this thread safety level should include comments indicating which methods are not threadsafe, and those methods should also be marked with their ownThreadSafetyannotations using theMETHOD_NOT_THREADSAFElevel. -
MOSTLY_NOT_THREADSAFE
The associated code is mostly not threadsafe, but there may be some methods which are safe to be invoked concurrently by multiple threads. The class-level documentation for a class including this thread safety level should include comments indicating which methods are threadsafe, and those methods should also be marked with their ownThreadSafetyannotations using theMETHOD_THREADSAFElevel. -
NOT_THREADSAFE
The associated code is not threadsafe. Unless otherwise noted, multiple threads may not attempt to invoke methods on the same instance of objects of this type without external synchronization. -
INTERFACE_THREADSAFE
Methods declared in the associated interface or abstract class must be threadsafe in classes which implement that interface or extend that abstract class. No guarantees will be made about the thread safety of other methods contained in that class which are not declared in the parent interface or superclass. -
INTERFACE_NOT_THREADSAFE
Methods declared in the associated interface or abstract class are not required to be threadsafe and classes which call them must not rely on the ability to concurrently invoke those methods on the same object instance without any external synchronization. -
METHOD_THREADSAFE
The associated method may be considered threadsafe and may be invoked concurrently by multiple threads, subject to the constraints described in theThreadSafetydocumentation, and in any additional notes contained in the method-level javadoc. -
METHOD_NOT_THREADSAFE
The associated method may not be considered threadsafe and should not be invoked concurrently by multiple threads.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
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
-
forName
Retrieves the thread safety level with the specified name.- Parameters:
name- The name of the thread safety level to retrieve. It must not benull.- Returns:
- The requested thread safety level, or
nullif no such level is defined.
-