Package org.hibernate

Interface Timeouts


@Incubating public interface Timeouts
Helpers for dealing with timeout values, including some "magic values".
Since:
7.0
API Note:
The NO_WAIT and SKIP_LOCKED magic values each have a corresponding LockMode (LockMode.UPGRADE_NOWAIT and LockMode.UPGRADE_SKIPLOCKED, respectively).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static 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_WAIT
    static final Timeout
    Indicates that rows which are already locked should be skipped.
    static final int
    Raw magic millisecond value for SKIP_LOCKED
    static 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 Methods
    Modifier and Type
    Method
    Description
    static int
    getTimeoutInSeconds(int timeoutInMilliseconds)
    Get the number of (whole) seconds represented by the given timeout.
    static int
    Get the number of (whole) seconds represented by the given timeout.
    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
    Is the timeout value a real value, as opposed to one of the "magic values".
  • Field Details

  • Method Details

    • interpretMilliSeconds

      static Timeout interpretMilliSeconds(int timeoutInMilliseconds)
      Similar to simply calling Timeout.milliseconds(int), but accounting for the "magic values".
    • isRealTimeout

      static boolean isRealTimeout(Timeout timeout)
      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

      static int getTimeoutInSeconds(Timeout timeout)
      Get the number of (whole) seconds represented by the given timeout.
    • getTimeoutInSeconds

      static int getTimeoutInSeconds(int timeoutInMilliseconds)
      Get the number of (whole) seconds represented by the given timeout.