Interface Deadline
-
- All Known Implementing Classes:
StaticDeadline
@Incubating public interface Deadline
Common interface providing a deadline through the methodcheckRemainingTimeMillis()
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
checkRemainingTimeMillis()
void
forceTimeout(Exception cause)
SearchTimeoutException
forceTimeoutAndCreateException(Exception cause)
-
-
-
Method Detail
-
checkRemainingTimeMillis
long checkRemainingTimeMillis()
- Returns:
- The remaining time to the deadline in milliseconds.
- Throws:
SearchTimeoutException
- If the deadline was reached and it's a hard deadline requiring immediate failure.
-
forceTimeout
void forceTimeout(Exception cause)
- Parameters:
cause
- The cause of the timeout, ornull
.- Throws:
SearchTimeoutException
- If the deadline is a hard deadline requiring immediate failure.
-
forceTimeoutAndCreateException
SearchTimeoutException forceTimeoutAndCreateException(Exception cause)
- Parameters:
cause
- The cause of the timeout, ornull
.- Returns:
- An exception to be thrown on timeout.
-
-