gpt4 book ai didi

org.apache.storm.utils.ZookeeperAuthInfo.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 07:49:31 25 4
gpt4 key购买 nike

本文整理了Java中org.apache.storm.utils.ZookeeperAuthInfo.<init>()方法的一些代码示例,展示了ZookeeperAuthInfo.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZookeeperAuthInfo.<init>()方法的具体详情如下:
包路径:org.apache.storm.utils.ZookeeperAuthInfo
类名称:ZookeeperAuthInfo
方法名:<init>

ZookeeperAuthInfo.<init>介绍

暂无

代码示例

代码示例来源:origin: apache/storm

public static CuratorFramework createZKClient(Map<String, Object> conf, DaemonType type) {
  @SuppressWarnings("unchecked")
  List<String> zkServers = (List<String>) conf.get(Config.STORM_ZOOKEEPER_SERVERS);
  Object port = conf.get(Config.STORM_ZOOKEEPER_PORT);
  ZookeeperAuthInfo zkAuthInfo = new ZookeeperAuthInfo(conf);
  CuratorFramework zkClient = CuratorUtils.newCurator(conf, zkServers, port,
                            (String) conf.get(Config.STORM_ZOOKEEPER_ROOT), zkAuthInfo,
                            type.getDefaultZkAcls(conf));
  zkClient.start();
  return zkClient;
}

代码示例来源:origin: apache/storm

private CuratorFrameworkFactory.Builder setupBuilder(boolean withExhibitor, boolean withAuth) {
    CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder();
    Map<String, Object> conf = new HashMap<String, Object>();
    if (withExhibitor) {
      conf.put(Config.STORM_EXHIBITOR_SERVERS, "foo");
      conf.put(Config.STORM_EXHIBITOR_PORT, 0);
      conf.put(Config.STORM_EXHIBITOR_URIPATH, "/exhibitor");
      conf.put(Config.STORM_EXHIBITOR_POLL, 0);
      conf.put(Config.STORM_EXHIBITOR_RETRY_INTERVAL, 0);
      conf.put(Config.STORM_EXHIBITOR_RETRY_INTERVAL_CEILING, 0);
      conf.put(Config.STORM_EXHIBITOR_RETRY_TIMES, 0);
    }
    conf.put(Config.STORM_ZOOKEEPER_CONNECTION_TIMEOUT, 0);
    conf.put(Config.STORM_ZOOKEEPER_SESSION_TIMEOUT, 0);
    conf.put(Config.STORM_ZOOKEEPER_RETRY_INTERVAL, 0);
    conf.put(Config.STORM_ZOOKEEPER_RETRY_INTERVAL_CEILING, 0);
    conf.put(Config.STORM_ZOOKEEPER_RETRY_TIMES, 0);
    String zkStr = new String("zk_connection_string");
    ZookeeperAuthInfo auth = null;
    if (withAuth) {
      auth = new ZookeeperAuthInfo("scheme", "abc".getBytes());
    }
    CuratorUtils.testSetupBuilder(builder, zkStr, conf, auth);
    return builder;
  }
}

代码示例来源:origin: apache/storm

protected TransactionalState(Map<String, Object> conf, String id, String subroot) {
  try {
    conf = new HashMap<>(conf);
    String transactionalRoot = (String) conf.get(Config.TRANSACTIONAL_ZOOKEEPER_ROOT);
    String rootDir = transactionalRoot + "/" + id + "/" + subroot;
    List<String> servers =
      (List<String>) getWithBackup(conf, Config.TRANSACTIONAL_ZOOKEEPER_SERVERS, Config.STORM_ZOOKEEPER_SERVERS);
    Object port = getWithBackup(conf, Config.TRANSACTIONAL_ZOOKEEPER_PORT, Config.STORM_ZOOKEEPER_PORT);
    ZookeeperAuthInfo auth = new ZookeeperAuthInfo(conf);
    CuratorFramework initter = CuratorUtils.newCuratorStarted(conf, servers, port, auth, DaemonType.WORKER.getDefaultZkAcls(conf));
    _zkAcls = Utils.getWorkerACL(conf);
    try {
      TransactionalState.createNode(initter, transactionalRoot, null, null, null);
    } catch (KeeperException.NodeExistsException e) {
    }
    try {
      TransactionalState.createNode(initter, rootDir, null, _zkAcls, null);
    } catch (KeeperException.NodeExistsException e) {
    }
    initter.close();
    _curator = CuratorUtils.newCuratorStarted(conf, servers, port, rootDir, auth, DaemonType.WORKER.getDefaultZkAcls(conf));
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: apache/storm

public CuratorFramework mkClientImpl(Map<String, Object> conf, List<String> servers, Object port, String root,
                     final WatcherCallBack watcher, Map<String, Object> authConf, DaemonType type) {
    CuratorFramework fk;
    if (authConf != null) {
      fk = CuratorUtils.newCurator(conf, servers, port, root, new ZookeeperAuthInfo(authConf), type.getDefaultZkAcls(conf));
    } else {
      fk = CuratorUtils.newCurator(conf, servers, port, root, null, type.getDefaultZkAcls(conf));
    }

    fk.getCuratorListenable().addListener((unused, e) -> {
      if (e.getType().equals(CuratorEventType.WATCHED)) {
        WatchedEvent event = e.getWatchedEvent();
        watcher.execute(event.getState(), event.getType(), event.getPath());
      }
    });
    LOG.info("Starting ZK Curator");
    fk.start();
    return fk;
  }
}

代码示例来源:origin: org.apache.storm/storm-core

public static CuratorFramework createZKClient(Map conf, List<ACL> defaultAcls) {
  List<String> zkServers = (List<String>) conf.get(Config.STORM_ZOOKEEPER_SERVERS);
  Object port = conf.get(Config.STORM_ZOOKEEPER_PORT);
  ZookeeperAuthInfo zkAuthInfo = new ZookeeperAuthInfo(conf);
  CuratorFramework zkClient = Utils.newCurator(conf, zkServers, port, (String) conf.get(Config.STORM_ZOOKEEPER_ROOT), zkAuthInfo, defaultAcls);
  zkClient.start();
  return zkClient;
}

代码示例来源:origin: org.apache.storm/storm-core

public  CuratorFramework mkClientImpl(Map conf, List<String> servers, Object port, String root, final WatcherCallBack watcher, Map authConf, List<ACL> defaultAcl) {
  CuratorFramework fk;
  if (authConf != null) {
    fk = Utils.newCurator(conf, servers, port, root, new ZookeeperAuthInfo(authConf), defaultAcl);
  } else {
    fk = Utils.newCurator(conf, servers, port, root, defaultAcl);
  }
  fk.getCuratorListenable().addListener(new CuratorListener() {
    @Override
    public void eventReceived(CuratorFramework _fk, CuratorEvent e) throws Exception {
      if (e.getType().equals(CuratorEventType.WATCHED)) {
        WatchedEvent event = e.getWatchedEvent();
        watcher.execute(event.getState(), event.getType(), event.getPath());
      }
    }
  });
  LOG.info("Staring ZK Curator");
  fk.start();
  return fk;
}

代码示例来源:origin: org.apache.storm/storm-core

protected TransactionalState(Map conf, String id, String subroot) {
  try {
    conf = new HashMap(conf);
    String transactionalRoot = (String)conf.get(Config.TRANSACTIONAL_ZOOKEEPER_ROOT);
    String rootDir = transactionalRoot + "/" + id + "/" + subroot;
    List<String> servers = (List<String>) getWithBackup(conf, Config.TRANSACTIONAL_ZOOKEEPER_SERVERS, Config.STORM_ZOOKEEPER_SERVERS);
    Object port = getWithBackup(conf, Config.TRANSACTIONAL_ZOOKEEPER_PORT, Config.STORM_ZOOKEEPER_PORT);
    ZookeeperAuthInfo auth = new ZookeeperAuthInfo(conf);
    CuratorFramework initter = Utils.newCuratorStarted(conf, servers, port, auth, null);
    _zkAcls = Utils.getWorkerACL(conf);
    try {
      TransactionalState.createNode(initter, transactionalRoot, null, null, null);
    } catch (KeeperException.NodeExistsException e) {
    }
    try {
      TransactionalState.createNode(initter, rootDir, null, _zkAcls, null);
    } catch (KeeperException.NodeExistsException e) {
    }
    initter.close();
                
    _curator = Utils.newCuratorStarted(conf, servers, port, rootDir, auth, null);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: org.apache.storm/storm-core

List<String> servers = (List<String>) getWithBackup(conf, Config.TRANSACTIONAL_ZOOKEEPER_SERVERS, Config.STORM_ZOOKEEPER_SERVERS);
Object port = getWithBackup(conf, Config.TRANSACTIONAL_ZOOKEEPER_PORT, Config.STORM_ZOOKEEPER_PORT);
ZookeeperAuthInfo auth = new ZookeeperAuthInfo(conf);
CuratorFramework initter = Utils.newCuratorStarted(conf, servers, port, auth, null);
_zkAcls = Utils.getWorkerACL(conf);

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com