initClient() { this.client = zookeeper.createClient(this.registry, { sessionTimeout: 30000, spinDelay: 1000, retries: 5 }); this.client.connect(); this.client.once("connected", this.onOnceConnected.bind(this)); this.checkConnection(); }
/** * Create a new provision dispatcher object * * @constructor * @param {object} zkConfig - zookeeper config object * @param {string} zkConfig.connectionString - zookeeper connection string * where provisions are managed * (e.g. "localhost:2181/shared-tasks") */ constructor(zkConfig) { this._zkEndpoint = zkConfig.connectionString; this._client = zookeeper.createClient(zkConfig.connectionString); this._client.connect(); this._connectWaitList = []; this._client.once('connected', () => { this._log.debug('connected to the ZK server'); this._connectWaitList.forEach(cb => cb()); this._connectWaitList = null; }); this._myName = null; this._myLeaderName = null; this._isLeader = false; this._owners = null; this._provisions = null; this._redispatchInProgress = false; this._redoRedispatch = false; this._log = new Logger('Backbeat:ProvisionDispatcher'); }
this.zkClient = zookeeper.createClient(connectionString); this.zkClient.connect(); this.zkClient.once('connected', () => { async.series([ next => this.zkClient.mkdirp(this.statePath, err => {
zkClient.once('connected', () => {