Class TimeoutManager
java.lang.Object
org.hibernate.search.engine.search.timeout.spi.TimeoutManager
- Author:
- Emmanuel Bernard
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Longprotected final TimeUnitprotected final Longprotected final TimingSourceprotected final TimeoutManager.Type -
Constructor Summary
ConstructorsConstructorDescriptionTimeoutManager(TimingSource timingSource, Long timeoutValue, TimeUnit timeoutUnit, TimeoutManager.Type type) -
Method Summary
Modifier and TypeMethodDescriptionbooleanprotected longstatic TimeoutManagerhardTimeout(TimingSource timingSource, long timeout, TimeUnit timeUnit) booleanbooleanstatic TimeoutManagernoTimeout(TimingSource timingSource) static TimeoutManagerof(TimingSource timingSource, Long timeout, TimeUnit timeUnit, boolean exceptionOnTimeout) static TimeoutManagersoftTimeout(TimingSource timingSource, long timeout, TimeUnit timeUnit) voidstart()we start counting from this method call (if needed)voidstop()longtookTime()Returns the time passed from the start with high precision.
-
Field Details
-
timingSource
-
timeoutValue
-
timeoutUnit
-
timeoutMs
-
type
-
-
Constructor Details
-
TimeoutManager
public TimeoutManager(TimingSource timingSource, Long timeoutValue, TimeUnit timeoutUnit, TimeoutManager.Type type)
-
-
Method Details
-
of
public static TimeoutManager of(TimingSource timingSource, Long timeout, TimeUnit timeUnit, boolean exceptionOnTimeout) -
noTimeout
-
softTimeout
public static TimeoutManager softTimeout(TimingSource timingSource, long timeout, TimeUnit timeUnit) -
hardTimeout
public static TimeoutManager hardTimeout(TimingSource timingSource, long timeout, TimeUnit timeUnit) -
start
public void start()we start counting from this method call (if needed) -
stop
public void stop() -
timingSource
-
deadlineOrNull
- Returns:
- The deadline for the timeout defined by this timeout manager,
nullif no timeout is set.
-
hardDeadlineOrNull
- Returns:
- The hard deadline defined by this timeout manager,
i.e. the deadline beyond which an exception should be thrown.
nullif no hard timeout is set.
-
timeoutBaseline
public long timeoutBaseline() -
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.
-
hasHardTimeout
public boolean hasHardTimeout() -
tookTime
Returns the time passed from the start with high precision. This method may be performance expensive.- Returns:
- high precision duration of took time.
-
elapsedTimeEstimateMillis
protected long elapsedTimeEstimateMillis()
-