Package org.apache.tika.config
Class TimeoutLimits
java.lang.Object
org.apache.tika.config.TimeoutLimits
- All Implemented Interfaces:
Serializable
Configuration for the two-tier task timeout system.
totalTaskTimeoutMillis— bounds entire task wall-clock time (default: 3,600,000 ms = 1 hour)progressTimeoutMillis— bounds time since the last progress update; catches infinite loops and hung processes (default: 60,000 ms = 1 minute)
Parsers that never call TikaProgressTracker.update() effectively get
progressTimeoutMillis as their total timeout (same as the old single-timeout
behavior). Parsers that do update progress can run up to
totalTaskTimeoutMillis.
Example configuration:
{
"parse-context": {
"timeout-limits": {
"totalTaskTimeoutMillis": 3600000,
"progressTimeoutMillis": 60000
}
}
}
- Since:
- Apache Tika 4.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longstatic final long -
Constructor Summary
ConstructorsConstructorDescriptionNo-arg constructor for Jackson deserialization.TimeoutLimits(long totalTaskTimeoutMillis, long progressTimeoutMillis) Constructor with both timeout parameters. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic TimeoutLimitsget(ParseContext context) Helper method to get TimeoutLimits from ParseContext with defaults.static longgetProcessTimeoutMillis(ParseContext context, long defaultMs) Returns the per-process timeout to use for external process execution.longGets the maximum time in milliseconds between progress updates before the task is considered stalled.longGets the maximum wall-clock time in milliseconds for a parse task.inthashCode()voidsetProgressTimeoutMillis(long progressTimeoutMillis) Sets the maximum time in milliseconds between progress updates before the task is considered stalled.voidsetTotalTaskTimeoutMillis(long totalTaskTimeoutMillis) Sets the maximum wall-clock time in milliseconds for a parse task.toString()
-
Field Details
-
DEFAULT_TOTAL_TASK_TIMEOUT_MILLIS
public static final long DEFAULT_TOTAL_TASK_TIMEOUT_MILLIS- See Also:
-
DEFAULT_PROGRESS_TIMEOUT_MILLIS
public static final long DEFAULT_PROGRESS_TIMEOUT_MILLIS- See Also:
-
-
Constructor Details
-
TimeoutLimits
public TimeoutLimits()No-arg constructor for Jackson deserialization. -
TimeoutLimits
public TimeoutLimits(long totalTaskTimeoutMillis, long progressTimeoutMillis) Constructor with both timeout parameters.- Parameters:
totalTaskTimeoutMillis- maximum wall-clock time for a taskprogressTimeoutMillis- maximum time between progress updates
-
-
Method Details
-
getTotalTaskTimeoutMillis
public long getTotalTaskTimeoutMillis()Gets the maximum wall-clock time in milliseconds for a parse task.- Returns:
- total task timeout in milliseconds
-
setTotalTaskTimeoutMillis
public void setTotalTaskTimeoutMillis(long totalTaskTimeoutMillis) Sets the maximum wall-clock time in milliseconds for a parse task.- Parameters:
totalTaskTimeoutMillis- total task timeout in milliseconds
-
getProgressTimeoutMillis
public long getProgressTimeoutMillis()Gets the maximum time in milliseconds between progress updates before the task is considered stalled.- Returns:
- progress timeout in milliseconds
-
setProgressTimeoutMillis
public void setProgressTimeoutMillis(long progressTimeoutMillis) Sets the maximum time in milliseconds between progress updates before the task is considered stalled.- Parameters:
progressTimeoutMillis- progress timeout in milliseconds
-
get
Helper method to get TimeoutLimits from ParseContext with defaults.- Parameters:
context- the ParseContext (may be null)- Returns:
- the TimeoutLimits from context, or a new instance with defaults if not found
-
getProcessTimeoutMillis
Returns the per-process timeout to use for external process execution.This checks for
TimeoutLimitsin the ParseContext and returnsmax(0, progressTimeoutMillis - 100)to give the monitoring loop a small window to detect the timeout before the process itself times out. Falls back todefaultMsif no TimeoutLimits is found.- Parameters:
context- the ParseContext (may be null)defaultMs- default timeout if no TimeoutLimits in context- Returns:
- timeout in milliseconds for external process execution
-
toString
-
equals
-
hashCode
public int hashCode()
-