aboutsummaryrefslogtreecommitdiffstats
path: root/zkfacade/src/main/java/com/yahoo/vespa/curator/VespaZooKeeperFactory.java
blob: 47f4348730fd084bbf076db9768da8f85f03d72f (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.curator;

import org.apache.curator.utils.ZookeeperFactory;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.client.ZKClientConfig;

/**
 * A ZooKeeper factory for creating a ZooKeeper client
 *
 * @author hmusum
 */
class VespaZooKeeperFactory implements ZookeeperFactory {

    private final ZKClientConfig zkClientConfig;

    VespaZooKeeperFactory(ZKClientConfig zkClientConfig) {
        this.zkClientConfig = zkClientConfig;
    }

    @Override
    public ZooKeeper newZooKeeper(String connectString, int sessionTimeout, Watcher watcher, boolean canBeReadOnly) throws Exception {
        return new ZooKeeper(connectString, sessionTimeout, watcher, zkClientConfig);
    }

}