Class TimeoutManager
- java.lang.Object
-
- org.hibernate.search.engine.search.timeout.spi.TimeoutManager
-
public class TimeoutManager extends Object
- Author:
- Emmanuel Bernard
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTimeoutManager.Type
-
Field Summary
Fields Modifier and Type Field Description protected LongtimeoutMsprotected TimingSourcetimingSourceprotected TimeoutManager.Typetype
-
Constructor Summary
Constructors Constructor Description TimeoutManager(TimingSource timingSource, Long timeoutMs, TimeoutManager.Type type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckTimedOut()LongcheckTimeLeftInMilliseconds()protected longelapsedTimeInMilliseconds()voidforceTimedOut()booleanhasHardTimeout()booleanisTimedOut()protected voidonTimedOut()LongremainingTimeToHardTimeout()If no hard timeout is defined, returnsnull.voidstart()we start counting from this method call (if needed)voidstop()longtimeoutBaseline()DurationtookTime()
-
-
-
Field Detail
-
timingSource
protected final TimingSource timingSource
-
timeoutMs
protected final Long timeoutMs
-
type
protected final TimeoutManager.Type type
-
-
Constructor Detail
-
TimeoutManager
public TimeoutManager(TimingSource timingSource, Long timeoutMs, TimeoutManager.Type type)
-
-
Method Detail
-
start
public void start()
we start counting from this method call (if needed)
-
stop
public void stop()
-
remainingTimeToHardTimeout
public Long remainingTimeToHardTimeout()
If no hard timeout is defined, returnsnull.- Returns:
- the remaining time to hard timeout in milliseconds
- Throws:
SearchTimeoutException- If the timeout was reached and a hard timeout was requested.
-
timeoutBaseline
public long timeoutBaseline()
-
checkTimeLeftInMilliseconds
public Long checkTimeLeftInMilliseconds()
- Returns:
trueif the timeout was reached,falseotherwise.- Throws:
SearchTimeoutException- If the timeout was reached and a hard timeout was requested.
-
isTimedOut
public boolean isTimedOut()
- Returns:
trueif the timeout was reached in a previous call tocheckTimedOut(),falseotherwise.
-
checkTimedOut
public boolean checkTimedOut()
- Returns:
trueif the timeout was reached,falseotherwise.- Throws:
SearchTimeoutException- If the timeout was reached and a hard timeout was requested.
-
forceTimedOut
public void forceTimedOut()
-
hasHardTimeout
public boolean hasHardTimeout()
-
tookTime
public Duration tookTime()
-
onTimedOut
protected void onTimedOut()
-
elapsedTimeInMilliseconds
protected long elapsedTimeInMilliseconds()
-
-