gpt4 book ai didi

org.apache.accumulo.fate.zookeeper.ZooReaderWriter.()方法的使用及代码示例

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

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

ZooReaderWriter.<init>介绍

暂无

代码示例

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

public static synchronized ZooReaderWriter getInstance(String zookeepers, int timeInMillis,
  String scheme, byte[] auth) {
 if (instance == null)
  instance = new ZooReaderWriter(zookeepers, timeInMillis, scheme, auth);
 return instance;
}

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

public DistributedWorkQueue(String path, AccumuloConfiguration config, long timerInitialDelay,
  long timerPeriod) {
 this.path = path;
 this.config = config;
 this.timerInitialDelay = timerInitialDelay;
 this.timerPeriod = timerPeriod;
 zoo = new ZooReaderWriter(config);
}

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

/**
  * Gets a new reader/writer.
  *
  * @param string
  *          ZooKeeper connection string
  * @param timeInMillis
  *          session timeout in milliseconds
  * @param secret
  *          instance secret
  * @return reader/writer
  */
 public IZooReaderWriter getZooReaderWriter(String string, int timeInMillis, String secret) {
  return new ZooReaderWriter(string, timeInMillis, SCHEME, (USER + ":" + secret).getBytes(UTF_8));
 }
}

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

private ServerContext(ServerInfo info) {
 super(info, info.getSiteConfiguration());
 this.info = info;
 zooReaderWriter = new ZooReaderWriter(info.getSiteConfiguration());
}

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

protected synchronized IZooReaderWriter getZooReaderWriter(ClientContext context,
  SiteConfiguration siteConfig, String secret) {
 if (secret == null) {
  secret = siteConfig.get(Property.INSTANCE_SECRET);
 }
 return new ZooReaderWriter(context.getZooKeepers(), context.getZooKeepersSessionTimeOut(),
   SCHEME, (USER + ":" + secret).getBytes());
}

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

@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN",
   justification = "code runs in same security context as user who provided input")
 public static void main(String[] args) throws Exception {
  Logger.getRootLogger().setLevel(Level.WARN);
  Opts opts = new Opts();
  opts.parseArgs(RestoreZookeeper.class.getName(), args);

  ZooReaderWriter zoo = new ZooReaderWriter(new SiteConfiguration());

  InputStream in = System.in;
  if (opts.file != null) {
   in = new FileInputStream(opts.file);
  }

  SAXParserFactory factory = SAXParserFactory.newInstance();
  // Prevent external entities by failing on any doctypes. We don't expect any doctypes, so this
  // is a simple switch to remove any chance of external entities causing problems.
  factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
  SAXParser parser = factory.newSAXParser();
  parser.parse(in, new Restore(zoo, opts.overwrite));
  in.close();
 }
}

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

public static void main(String[] args) {
 Opts opts = new Opts();
 opts.parseArgs(DumpZookeeper.class.getName(), args);
 Logger.getRootLogger().setLevel(Level.WARN);
 PrintStream out = System.out;
 try {
  zk = new ZooReaderWriter(opts.getSiteConfiguration());
  if (opts.xml) {
   writeXml(out, opts.root);
  } else {
   writeHumanReadable(out, opts.root);
  }
 } catch (Exception ex) {
  log.error(ex, ex);
 }
}

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

private static void verifyAccumuloIsDown(ServerContext context, String oldPassword)
  throws Exception {
 ZooReader zooReader = new ZooReaderWriter(context.getZooKeepers(),
   context.getZooKeepersSessionTimeOut(), oldPassword);
 String root = context.getZooKeeperRoot();
 final List<String> ephemerals = new ArrayList<>();
 recurse(zooReader, root, new Visitor() {
  @Override
  public void visit(ZooReader zoo, String path) throws Exception {
   Stat stat = zoo.getStatus(path);
   if (stat.getEphemeralOwner() != 0)
    ephemerals.add(path);
  }
 });
 if (ephemerals.size() > 0) {
  System.err.println("The following ephemeral nodes exist, something is still running:");
  for (String path : ephemerals) {
   System.err.println(path);
  }
  throw new Exception("Accumulo must be shut down in order to run this tool.");
 }
}

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

private static void deleteInstance(ServerContext context, String oldPass) throws Exception {
  IZooReaderWriter orig = new ZooReaderWriter(context.getZooKeepers(),
    context.getZooKeepersSessionTimeOut(), oldPass);
  orig.recursiveDelete("/accumulo/" + context.getInstanceID(), NodeMissingPolicy.SKIP);
 }
}

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

/**
 * @param args
 *          : the name or UUID of the instance to be deleted
 */
public static void main(String[] args) throws Exception {
 Opts opts = new Opts();
 opts.parseArgs(DeleteZooInstance.class.getName(), args);
 ZooReaderWriter zk = new ZooReaderWriter(new SiteConfiguration());
 // try instance name:
 Set<String> instances = new HashSet<>(zk.getChildren(Constants.ZROOT + Constants.ZINSTANCES));
 Set<String> uuids = new HashSet<>(zk.getChildren(Constants.ZROOT));
 uuids.remove("instances");
 if (instances.contains(opts.instance)) {
  String path = Constants.ZROOT + Constants.ZINSTANCES + "/" + opts.instance;
  byte[] data = zk.getData(path, null);
  deleteRetry(zk, path);
  deleteRetry(zk, Constants.ZROOT + "/" + new String(data, UTF_8));
 } else if (uuids.contains(opts.instance)) {
  // look for the real instance name
  for (String instance : instances) {
   String path = Constants.ZROOT + Constants.ZINSTANCES + "/" + instance;
   byte[] data = zk.getData(path, null);
   if (opts.instance.equals(new String(data, UTF_8)))
    deleteRetry(zk, path);
  }
  deleteRetry(zk, Constants.ZROOT + "/" + opts.instance);
 }
}

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

private static void rewriteZooKeeperInstance(final ServerContext context,
  final String newInstanceId, String oldPass, String newPass) throws Exception {
 final ZooReaderWriter orig = new ZooReaderWriter(context.getZooKeepers(),
   context.getZooKeepersSessionTimeOut(), oldPass);
 final IZooReaderWriter new_ = new ZooReaderWriter(context.getZooKeepers(),
   context.getZooKeepersSessionTimeOut(), newPass);

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

setZooReaderWriter(new ZooReaderWriter(siteConfig));
SecurityUtil.serverLogin(siteConfig);
Configuration hadoopConfig = new Configuration();

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

Path instanceDir = new Path(volDir, "instance_id");
String iid = ZooUtil.getInstanceIDFromHdfs(instanceDir, siteConf, hadoopConf);
ZooReaderWriter zoo = new ZooReaderWriter(siteConf);

代码示例来源:origin: org.apache.accumulo/accumulo-fate

public static synchronized ZooReaderWriter getInstance(String zookeepers, int timeInMillis,
  String scheme, byte[] auth) {
 if (instance == null)
  instance = new ZooReaderWriter(zookeepers, timeInMillis, scheme, auth);
 return instance;
}

代码示例来源:origin: org.apache.accumulo/accumulo-server-base

/**
 * Gets a new reader/writer.
 *
 * @param string
 *          ZooKeeper connection string
 * @param timeInMillis
 *          session timeout in milliseconds
 * @param secret
 *          instance secret
 * @return reader/writer
 */
public IZooReaderWriter getZooReaderWriter(String string, int timeInMillis, String secret) {
 return new ZooReaderWriter(string, timeInMillis, SCHEME, (USER + ":" + secret).getBytes(UTF_8));
}

代码示例来源:origin: org.apache.accumulo/accumulo-shell

protected synchronized IZooReaderWriter getZooReaderWriter(Instance instance, String secret) {
 if (secret == null) {
  AccumuloConfiguration conf = SiteConfiguration.getInstance();
  secret = conf.get(Property.INSTANCE_SECRET);
 }
 return new ZooReaderWriter(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut(),
   SCHEME, (USER + ":" + secret).getBytes());
}

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