- All Implemented Interfaces:
public class ConnectionControlSearcher extends SearcherSearcher which can enforce HTTP connection close based on query properties.
This searcher informs the client to close a persistent HTTP connection if the connection is older than the configured max lifetime. This is done by adding the "Connection" HTTP header with the value "Close" to the result.
The searcher reads the query property "connectioncontrol.maxlifetime", which is an integer number of seconds, to get the value for maximum connection lifetime. Setting it to zero will enforce connection close independently of the age of the connection. Typical usage would be as follows:
- Add the ConnectionControlSearcher to the default search chain of your application. (It has no special ordering considerations.)
- For the default query profile of your application, set a reasonable value for "connectioncontrol.maxlifetime". The definition of reasonable will be highly application dependent, but it should always be less than the grace period when taking the container out of production traffic.
- Deploy application. The container will now inform clients to close connections/reconnect within the configured time limit.
- frodelu, Steinar Knutsen
Constructors Constructor Description
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description
createTestInstance(java.util.function.LongSupplier clock)Create a searcher instance suitable for unit tests.
search(Query query, Execution execution)Override this to implement your searcher.
Methods inherited from class com.yahoo.search.Searcher
ensureFilled, fill, getLogger, process, toString
Methods inherited from class com.yahoo.component.chain.ChainedComponent
getAnnotatedDependencies, getDefaultAnnotatedDependencies, getDependencies, initDependencies
Methods inherited from class com.yahoo.component.AbstractComponent
public static ConnectionControlSearcher createTestInstance(java.util.function.LongSupplier clock)Create a searcher instance suitable for unit tests.
clock- a simulated or real clock behaving similarly to System.currentTimeMillis()
- a fully initialised instance
searchDescription copied from class:
Searcher implementation subclasses will, depending on their type of logic, do one of the following:
- Query processors: Access the query, then call execution.search and return the result
- Result processors: Call execution.search to get the result, access it and return
- Sources (which produces results): Create a result, add the desired hits and return it.
Error handling in searchers:
- Recoverable user errors: Add a FeedbackHit explaining the condition and how to correct it.