Пример #1
0
void config_fromzk(lock_service& z,
                    const string& type, const string& name,
                    string& config)
{
  // server must get read lock for config_lock before call this method.
  string path;
  build_config_path(path, type, name);

  if(!z.exists(path))
    throw JUBATUS_EXCEPTION(jubatus::exception::runtime_error("config is not exists: " + path));

  if (!z.read(path, config))
    throw JUBATUS_EXCEPTION(jubatus::exception::runtime_error("failed to get config from zookeeper: " + path)
        << jubatus::exception::error_api_func("lock_service::read"));

  LOG(INFO) << "get config from zookeeper: " << path;
}