Skip to content
This repository has been archived by the owner on Oct 30, 2020. It is now read-only.

set connect timeout to a more reasonable value than 100ms #11

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ public class ClientMain

def start()
{
def connectString = config.zkConnectionString ?: "localhost:2181"
def connectString = config.zkConnectionString ?: "localhost:2181"
def connectTimeout = config.zkConnectionTimeout ?: "100"

client = new ZKClient(connectString, Timespan.parse('100'), null)
client = new ZKClient(connectString, Timespan.parse(connectTimeout), null)

client.start()
log.debug "Talking to zookeeper on ${connectString}"
Expand All @@ -78,9 +79,10 @@ public class ClientMain

static int mainNoExit(Object args)
{
def cli = new CliBuilder(usage: './bin/zk.sh [-h] [-s <zkConnectionString>] command')
def cli = new CliBuilder(usage: './bin/zk.sh [-h] [-s <zkConnectionString>] [-t <zkConnectionTimeout>] command')
cli.h(longOpt: 'help', 'display help')
cli.s(longOpt: 'zkConnectionString', 'the zookeeper connection string (host:port)', args: 1, required: false)
cli.t(longOpt: 'zkConnectionTimeout', 'the zookeeper connection timeout (e.g. 10s)', args: 2, required: false)

// this is splitting the main cmdline args from the command and its args
boolean isMainArg = true
Expand Down