backtype.storm.utils.Utils.newCuratorStarted()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(114)

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

Utils.newCuratorStarted介绍

暂无

代码示例

代码示例来源:origin: alibaba/jstorm

public TransactionalStateZkStorage(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);
    _zkAcls = Utils.getWorkerACL(conf);
    try {
      createNode(initter, transactionalRoot, null, null, null);
    } catch (KeeperException.NodeExistsException ignored) {
    }
    try {
      createNode(initter, rootDir, null, _zkAcls, null);
    } catch (KeeperException.NodeExistsException ignored) {
    }
    initter.close();
    _curator = Utils.newCuratorStarted(conf, servers, port, rootDir, auth);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: alibaba/jstorm

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);
_zkAcls = Utils.getWorkerACL(conf);
try {
_curator = Utils.newCuratorStarted(conf, servers, port, rootDir, auth);
_ser = new KryoValuesSerializer(conf);
_des = new KryoValuesDeserializer(conf);

代码示例来源:origin: alibaba/mdrill

protected TransactionalState(Map conf, String id, Map componentConf, String subroot) {
  try {
    conf = new HashMap(conf);
    // ensure that the serialization registrations are consistent with the declarations in this spout
    if(componentConf!=null) {
      conf.put(Config.TOPOLOGY_KRYO_REGISTER,
           componentConf
             .get(Config.TOPOLOGY_KRYO_REGISTER));
    }
    String rootDir = conf.get(Config.TRANSACTIONAL_ZOOKEEPER_ROOT) + "/" + 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);
    CuratorFramework initter = Utils.newCuratorStarted(conf, servers, port);
    try {
      initter.create().creatingParentsIfNeeded().forPath(rootDir);
    } catch(KeeperException.NodeExistsException e)  {
      
    }
    
    initter.close();
                
    _curator = Utils.newCuratorStarted(conf, servers, port, rootDir);
    _ser = new KryoValuesSerializer(conf);
    _des = new KryoValuesDeserializer(conf);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.n3twork.storm/storm-core

protected TransactionalState(Map conf, String id, String subroot) {
  try {
    conf = new HashMap(conf);
    String rootDir = conf.get(Config.TRANSACTIONAL_ZOOKEEPER_ROOT) + "/" + 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);
    CuratorFramework initter = Utils.newCuratorStarted(conf, servers, port);
    try {
      initter.create().creatingParentsIfNeeded().forPath(rootDir);
    } catch(KeeperException.NodeExistsException e)  {
      
    }
    
    initter.close();
                
    _curator = Utils.newCuratorStarted(conf, servers, port, rootDir);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.n3twork.storm/storm-core

protected TransactionalState(Map conf, String id, Map componentConf, String subroot) {
  try {
    conf = new HashMap(conf);
    // ensure that the serialization registrations are consistent with the declarations in this spout
    if(componentConf!=null) {
      conf.put(Config.TOPOLOGY_KRYO_REGISTER,
           componentConf
             .get(Config.TOPOLOGY_KRYO_REGISTER));
    }
    String rootDir = conf.get(Config.TRANSACTIONAL_ZOOKEEPER_ROOT) + "/" + 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);
    CuratorFramework initter = Utils.newCuratorStarted(conf, servers, port);
    try {
      initter.create().creatingParentsIfNeeded().forPath(rootDir);
    } catch(KeeperException.NodeExistsException e)  {
      
    }
    
    initter.close();
                
    _curator = Utils.newCuratorStarted(conf, servers, port, rootDir);
    _ser = new KryoValuesSerializer(conf);
    _des = new KryoValuesDeserializer(conf);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.alibaba.jstorm/jstorm-core

public TransactionalStateZkStorage(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);
    _zkAcls = Utils.getWorkerACL(conf);
    try {
      createNode(initter, transactionalRoot, null, null, null);
    } catch (KeeperException.NodeExistsException e) {
    }
    try {
      createNode(initter, rootDir, null, _zkAcls, null);
    } catch (KeeperException.NodeExistsException e) {
    }
    initter.close();
    _curator = Utils.newCuratorStarted(conf, servers, port, rootDir, auth);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.alibaba.jstorm/jstorm-core

protected TransactionalState(Map conf, String id, Map componentConf, String subroot) {
  try {
    conf = new HashMap(conf);
    // ensure that the serialization registrations are consistent with the declarations in this spout
    if (componentConf != null) {
      conf.put(Config.TOPOLOGY_KRYO_REGISTER, componentConf.get(Config.TOPOLOGY_KRYO_REGISTER));
    }
    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);
    _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);
    _ser = new KryoValuesSerializer(conf);
    _des = new KryoValuesDeserializer(conf);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

相关文章