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(); }
var coordinator = function () { var self = this; self._client = zk.createClient(ZK_CONFIG.hosts) self._client.once('connected', self.lookForLeader.bind(self)); self._self._client.connect(); self.isLeader = false; self.emiter = new EventEmitter(); }
/** * 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'); }
function setupZkTestState(cb) { const { connectionString } = config.zookeeper; zkClient = zookeeper.createClient(connectionString); zkClient.connect(); zkClient.once('connected', () => {
describe("Delete task:", function () { var sandbox; var zkClient = zookeeper.createClient("127.0.0.1"); before(function () { sandbox = sinon.sandbox.create();
this.zkClient = zookeeper.createClient(connectionString); this.zkClient.connect(); this.zkClient.once('connected', () => {
const zkClient = zookeeper.createClient(connectionString, options); zkClient.once('connected', () => { const hostPort = connectionString.slice(0, nsIndex); const namespace = connectionString.slice(nsIndex); const rootZkClient = zookeeper.createClient(hostPort, options); rootZkClient.connect(); return rootZkClient.mkdirp(namespace, err => {
const zkClient = zookeeper.createClient('localhost:2181'); zkClient.connect(); zkClient.on('connected', () => {
describe("Save task:", function () { var sandbox; var zkClient = zookeeper.createClient("127.0.0.1"); before(function () { sandbox = sinon.sandbox.create();