lib/invoker.js
function Invoker(zk, opt) {
  if (!(this instanceof Invoker)) return new Invoker(zk, opt);

  var option = opt || {};
  this._path = option.path;
  this._dubbo = option.dubbo;
  this._version = option.version;
  this._timeout = option.timeout;
  this._poolMax = option.poolMax;
  this._poolMin = option.poolMin;

  this._providers = null; // Array
  this._configurators = null; // Object
  this._loadBalance = new RandomLoadBalance();

  this._parseProviders = this._parseProviders.bind(this);
  this._parseConfigurators = this._parseConfigurators.bind(this);

  if ('string' === typeof zk) {
    this._uris = [zk];
  } else if (Array.isArray(zk)) {
    this._uris = zk;
  } else if (zk) {
    this._registerProviders = new Register(zk, '/dubbo/' + this._path + '/providers');
    this._registerConfigurators = new Register(zk, '/dubbo/' + this._path + '/configurators');
    this._registerProviders.on('change', this._parseProviders);
    this._registerConfigurators.on('change', this._parseConfigurators);
  }
}
function Invoker(zk, opt) {
  if (!(this instanceof Invoker)) return new Invoker(zk, opt);

  var option = opt || {};
  this._path = option.path;
  this._dubbo = option.dubbo;
  this._version = option.version;
  this._timeout = option.timeout;
  this._poolMax = option.poolMax;
  this._poolMin = option.poolMin;

  this._providers = null; // Array
  this._configurators = null; // Object
  this._loadBalance = new RandomLoadBalance();

  this._parseProviders = this._parseProviders.bind(this);
  this._parseConfigurators = this._parseConfigurators.bind(this);

  if ('string' === typeof zk) {
    this._uris = [zk];
  } else if (Array.isArray(zk)) {
    this._uris = zk;
  } else if (zk) {
    this._registerProviders = new Register(zk, '/dubbo/' + this._path + '/providers');
    this._registerConfigurators = new Register(zk, '/dubbo/' + this._path + '/configurators');
    this._registerProviders.on('change', this._parseProviders);
    this._registerConfigurators.on('change', this._parseConfigurators);
  }
}
function Invoker ( zk , opt ) { if ( ! ( this instanceof Invoker ) ) return new Invoker ( zk , opt ) ; var option = opt || { } ; this . _path = option . path ; this . _dubbo = option . dubbo ; this . _version = option . version ; this . _timeout = option . timeout ; this . _poolMax = option . poolMax ; this . _poolMin = option . poolMin ; this . _providers = null ; // Array this . _configurators = null ; // Object this . _loadBalance = new RandomLoadBalance ( ) ; this . _parseProviders = this . _parseProviders . bind ( this ) ; this . _parseConfigurators = this . _parseConfigurators . bind ( this ) ; if ( 'string' === typeof zk ) { this . _uris = [ zk ] ; } else if ( Array . isArray ( zk ) ) { this . _uris = zk ; } else if ( zk ) { this . _registerProviders = new Register ( zk , '/dubbo/' + this . _path + '/providers' ) ; this . _registerConfigurators = new Register ( zk , '/dubbo/' + this . _path + '/configurators' ) ; this . _registerProviders . on ( 'change' , this . _parseProviders ) ; this . _registerConfigurators . on ( 'change' , this . _parseConfigurators ) ; } }
Constructor of Invoker.

@param {Client|String|Array} zk // The ZD instance or the uri of providers.
@param {Object} opt
{
path: String // The path of service node.
version: String, // The version of service.
timeout: Number, // Timeout in milliseconds, defaults to 60 seconds.
}
@returns {Invoker}
@constructor
Constructor of Invoker .