Package org.hibernate
Interface Timeouts
Helpers for dealing with timeout
values, including some "magic values".
- Since:
- 7.0
- API Note:
- The
NO_WAIT
andSKIP_LOCKED
magic values each have a correspondingLockMode
(LockMode.UPGRADE_NOWAIT
andLockMode.UPGRADE_SKIPLOCKED
, respectively).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Timeout
Indicates that the database should not wait at all to acquire a pessimistic lock which is not immediately available.static final int
Raw magic millisecond value for NO_WAITstatic final Timeout
Indicates that rows which are already locked should be skipped.static final int
Raw magic millisecond value for SKIP_LOCKEDstatic final Timeout
Indicates that there is no timeout for the lock acquisition, that is, that the database should in principle wait forever to obtain the lock.static final int
Raw magic millisecond value for WAIT_FOREVER -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic int
getTimeoutInSeconds
(int timeoutInMilliseconds) Get the number of (whole) seconds represented by the giventimeout
.static int
getTimeoutInSeconds
(Timeout timeout) Get the number of (whole) seconds represented by the giventimeout
.static Timeout
interpretMilliSeconds
(int timeoutInMilliseconds) Similar to simply calling Timeout.milliseconds(int), but accounting for the "magic values".static boolean
isRealTimeout
(int timeoutInMilliseconds) Is the timeout value a real value, as opposed to one of the "magic values".static boolean
isRealTimeout
(Timeout timeout) Is the timeout value a real value, as opposed to one of the "magic values".
-
Field Details
-
NO_WAIT_MILLI
static final int NO_WAIT_MILLIRaw magic millisecond value for NO_WAIT- See Also:
-
WAIT_FOREVER_MILLI
static final int WAIT_FOREVER_MILLIRaw magic millisecond value for WAIT_FOREVER- See Also:
-
SKIP_LOCKED_MILLI
static final int SKIP_LOCKED_MILLIRaw magic millisecond value for SKIP_LOCKED- See Also:
-
NO_WAIT
Indicates that the database should not wait at all to acquire a pessimistic lock which is not immediately available.- See Also:
-
WAIT_FOREVER
Indicates that there is no timeout for the lock acquisition, that is, that the database should in principle wait forever to obtain the lock.- See Also:
-
SKIP_LOCKED
Indicates that rows which are already locked should be skipped.- See Also:
-
-
Method Details
-
interpretMilliSeconds
Similar to simply calling Timeout.milliseconds(int), but accounting for the "magic values". -
isRealTimeout
Is the timeout value a real value, as opposed to one of the "magic values". Functionally, returns whether the value is greater than zero. -
isRealTimeout
static boolean isRealTimeout(int timeoutInMilliseconds) Is the timeout value a real value, as opposed to one of the "magic values". Functionally, returns whether the value is greater than zero. -
getTimeoutInSeconds
Get the number of (whole) seconds represented by the giventimeout
. -
getTimeoutInSeconds
static int getTimeoutInSeconds(int timeoutInMilliseconds) Get the number of (whole) seconds represented by the giventimeout
.
-