Package org.hibernate
Interface Timeouts
Helpers for dealing with timeout
values, including some "magic values".
- Since:
- 7.0
- API Note:
- The
NO_WAITandSKIP_LOCKEDmagic values each have a correspondingLockMode(LockMode.UPGRADE_NOWAITandLockMode.UPGRADE_SKIPLOCKED, respectively).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TimeoutIndicates that the database should not wait at all to acquire a pessimistic lock which is not immediately available.static final intRaw magic millisecond value for NO_WAITstatic final TimeoutTimeout of 1 second.static final TimeoutIndicates that rows which are already locked should be skipped.static final intRaw magic millisecond value for SKIP_LOCKEDstatic final TimeoutIndicates 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 intRaw magic millisecond value for WAIT_FOREVER -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic intstatic intgetTimeoutInSeconds(int timeoutInMilliseconds) Get the number of (whole) seconds represented by the giventimeout.static intgetTimeoutInSeconds(Timeout timeout) Get the number of (whole) seconds represented by the giventimeout.static TimeoutinterpretMilliSeconds(int timeoutInMilliseconds) Similar to simply calling Timeout.milliseconds(int), but accounting for the "magic values".static booleanisMagicValue(int millis) Whether the given value is one of the magic values - NO_WAIT_MILLI WAIT_FOREVER_MILLI SKIP_LOCKED_MILLIstatic booleanisMagicValue(Timeout timeout) static booleanisRealTimeout(int timeoutInMilliseconds) Whether the timeout value is a real value, as opposed to one of the "magic values".static booleanisRealTimeout(Timeout timeout) Whether the timeout value is a real value, as opposed to one of the "magic values".
-
Field Details
-
ONE_SECOND
Timeout of 1 second. -
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". -
isMagicValue
Whether the given timeout is one of the magic values -- See Also:
-
isMagicValue
static boolean isMagicValue(int millis) Whether the given value is one of the magic values -- See Also:
-
isRealTimeout
Whether the timeout value is 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) Whether the timeout value is 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. -
fromHint
-