blob: 6edcd8901def63306ad703dd1cd822a07c2766ed (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.container.search;
import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.osgi.provider.model.ComponentModel;
import com.yahoo.vespa.config.search.DispatchConfig;
import com.yahoo.vespa.model.container.component.Component;
import com.yahoo.vespa.model.container.PlatformBundles;
import com.yahoo.vespa.model.search.IndexedSearchCluster;
/**
* Represents a dispatcher component - an instance of a dispatcher in a search container cluster
* knows how to communicate with one indexed search cluster and owns the connections to it.
*
* @author bratseth
*/
public class DispatcherComponent extends Component<AbstractConfigProducer<?>, ComponentModel>
implements DispatchConfig.Producer {
private final IndexedSearchCluster indexedSearchCluster;
public DispatcherComponent(IndexedSearchCluster indexedSearchCluster) {
super(toComponentModel(indexedSearchCluster));
this.indexedSearchCluster = indexedSearchCluster;
String clusterName = indexedSearchCluster.getClusterName();
var rpcResoucePool = new RpcResourcePoolComponent(clusterName);
inject(rpcResoucePool);
addComponent(rpcResoucePool);
}
private static ComponentModel toComponentModel(IndexedSearchCluster indexedSearchCluster) {
String dispatcherComponentId = "dispatcher." + indexedSearchCluster.getClusterName(); // used by ClusterSearcher
return new ComponentModel(dispatcherComponentId,
com.yahoo.search.dispatch.Dispatcher.class.getName(),
PlatformBundles.searchAndDocprocBundle);
}
@Override
public void getConfig(DispatchConfig.Builder builder) {
indexedSearchCluster.getConfig(builder);
}
}
|