Package com.yahoo.search.dispatch
Class InterleavedSearchInvoker
- java.lang.Object
-
- com.yahoo.search.dispatch.CloseableInvoker
-
- com.yahoo.search.dispatch.SearchInvoker
-
- com.yahoo.search.dispatch.InterleavedSearchInvoker
-
- All Implemented Interfaces:
ResponseMonitor<SearchInvoker>
,java.io.Closeable
,java.lang.AutoCloseable
public class InterleavedSearchInvoker extends SearchInvoker implements ResponseMonitor<SearchInvoker>
InterleavedSearchInvoker uses multipleSearchInvoker
objects to interface with content nodes in parallel. Operationally it first sends requests to all contained invokers and then collects the results. The user of this class is responsible for merging the results if needed.- Author:
- ollivir
-
-
Constructor Summary
Constructors Constructor Description InterleavedSearchInvoker(java.util.Collection<SearchInvoker> invokers, SearchCluster searchCluster, java.util.Set<java.lang.Integer> alreadyFailedNodes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected long
currentTime()
protected InvokerResult
getSearchResult(Execution execution)
protected java.util.concurrent.LinkedBlockingQueue<SearchInvoker>
newQueue()
protected void
release()
void
responseAvailable(SearchInvoker from)
protected java.lang.Object
sendSearchRequest(Query query, java.lang.Object unusedContext)
Sends search queries to the containedSearchInvoker
sub-invokers.protected void
setMonitor(ResponseMonitor<SearchInvoker> monitor)
-
Methods inherited from class com.yahoo.search.dispatch.SearchInvoker
distributionKey, errorResult, responseAvailable, search
-
Methods inherited from class com.yahoo.search.dispatch.CloseableInvoker
close, setFinalStatus, teardown
-
-
-
-
Constructor Detail
-
InterleavedSearchInvoker
public InterleavedSearchInvoker(java.util.Collection<SearchInvoker> invokers, SearchCluster searchCluster, java.util.Set<java.lang.Integer> alreadyFailedNodes)
-
-
Method Detail
-
sendSearchRequest
protected java.lang.Object sendSearchRequest(Query query, java.lang.Object unusedContext) throws java.io.IOException
Sends search queries to the containedSearchInvoker
sub-invokers. If the search query has an offset other than zero, it will be reset to zero and the expected hit amount will be adjusted accordingly.- Specified by:
sendSearchRequest
in classSearchInvoker
- Parameters:
query
- the query to sendunusedContext
- a context object that can be used to pass context among different invokers, e.g for reuse of preserialized data.- Returns:
- an object that can be passed to the next invocation of sendSearchRequest
- Throws:
java.io.IOException
-
getSearchResult
protected InvokerResult getSearchResult(Execution execution) throws java.io.IOException
- Specified by:
getSearchResult
in classSearchInvoker
- Throws:
java.io.IOException
-
release
protected void release()
- Specified by:
release
in classCloseableInvoker
-
responseAvailable
public void responseAvailable(SearchInvoker from)
- Specified by:
responseAvailable
in interfaceResponseMonitor<SearchInvoker>
-
setMonitor
protected void setMonitor(ResponseMonitor<SearchInvoker> monitor)
- Overrides:
setMonitor
in classSearchInvoker
-
currentTime
protected long currentTime()
-
newQueue
protected java.util.concurrent.LinkedBlockingQueue<SearchInvoker> newQueue()
-
-