Class StaticDeadline

java.lang.Object
org.hibernate.search.engine.common.timing.spi.StaticDeadline
All Implemented Interfaces:
Deadline

public final class StaticDeadline extends Object implements Deadline
  • Method Details

    • ofMilliseconds

      public static Deadline ofMilliseconds(long milliseconds)
      Parameters:
      milliseconds - The number of milliseconds until the deadline.
      Returns:
      An immutable Deadline which does not track the passing time. checkRemainingTimeMillis() will always return the same value and will never throw an exception.
    • checkRemainingTimeMillis

      public long checkRemainingTimeMillis()
      Specified by:
      checkRemainingTimeMillis in interface Deadline
      Returns:
      The remaining time to the deadline in milliseconds.
    • forceTimeout

      public void forceTimeout(Exception cause)
      Specified by:
      forceTimeout in interface Deadline
      Parameters:
      cause - The cause of the timeout, or null.
    • forceTimeoutAndCreateException

      public SearchTimeoutException forceTimeoutAndCreateException(Exception cause)
      Specified by:
      forceTimeoutAndCreateException in interface Deadline
      Parameters:
      cause - The cause of the timeout, or null.
      Returns:
      An exception to be thrown on timeout.