blob: a7cd14c415fa2fd1410ff6948c63c4b5fa1d43b7 (
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
44
45
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.zookeeper;
import com.yahoo.cloud.config.ZookeeperServerConfig;
import com.yahoo.component.AbstractComponent;
import com.yahoo.component.annotation.Inject;
import com.yahoo.vespa.zookeeper.server.VespaZooKeeperServer;
import java.nio.file.Path;
/**
*
* Server used for starting config server, needed to be able to have different behavior for hosted and
* self-hosted Vespa (controlled by zookeeperServerConfig.dynamicReconfiguration).
*
* @author Harald Musum
*/
public class ConfigServerZooKeeperServer extends AbstractComponent implements VespaZooKeeperServer {
private final VespaZooKeeperServer zooKeeperServer;
@Inject
public ConfigServerZooKeeperServer(ZookeeperServerConfig zookeeperServerConfig) {
this.zooKeeperServer = zookeeperServerConfig.dynamicReconfiguration()
? new ReconfigurableVespaZooKeeperServer(new Reconfigurer(new VespaZooKeeperAdminImpl()), zookeeperServerConfig)
: new VespaZooKeeperServerImpl(zookeeperServerConfig);
}
@Override
public void deconstruct() { zooKeeperServer.shutdown(); }
@Override
public void shutdown() {
zooKeeperServer.shutdown();
}
@Override
public void start(Path configFilePath) {
zooKeeperServer.start(configFilePath);
}
@Override
public boolean reconfigurable() { return zooKeeperServer.reconfigurable(); }
}
|