Examples of ZooCache


Examples of org.apache.accumulo.fate.zookeeper.ZooCache

    }
  }
 
  private HdfsZooInstance() {
    AccumuloConfiguration acuConf = ServerConfiguration.getSiteConfiguration();
    zooCache = new ZooCache(acuConf.get(Property.INSTANCE_ZK_HOST), (int) acuConf.getTimeInMillis(Property.INSTANCE_ZK_TIMEOUT));
  }
View Full Code Here

Examples of org.apache.accumulo.fate.zookeeper.ZooCache

   * @see org.apache.accumulo.core.client.admin.InstanceOperations#getTabletServers()
   */
 
  @Override
  public List<String> getTabletServers() {
    ZooCache cache = ZooCache.getInstance(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut());
    String path = ZooUtil.getRoot(instance) + Constants.ZTSERVERS;
    List<String> results = new ArrayList<String>();
    for (String candidate : cache.getChildren(path)) {
      List<String> children = cache.getChildren(path + "/" + candidate);
      if (children != null && children.size() > 0) {
        List<String> copy = new ArrayList<String>(children);
        Collections.sort(copy);
        byte[] data = cache.get(path + "/" + candidate + "/" + copy.get(0));
        if (data != null && !"master".equals(new String(data))) {
          results.add(candidate);
        }
      }
    }
View Full Code Here

Examples of org.apache.accumulo.fate.zookeeper.ZooCache

    this.parent = parent;
  }
 
  synchronized public static ZooConfiguration getInstance(Instance inst, AccumuloConfiguration parent) {
    if (instance == null) {
      propCache = new ZooCache(inst.getZooKeepers(), inst.getZooKeepersSessionTimeOut());
      instance = new ZooConfiguration(parent);
      instanceId = inst.getInstanceID();
    }
    return instance;
  }
View Full Code Here

Examples of org.apache.accumulo.fate.zookeeper.ZooCache

    return instance;
  }
 
  synchronized public static ZooConfiguration getInstance(AccumuloConfiguration parent) {
    if (instance == null) {
      propCache = new ZooCache(parent.get(Property.INSTANCE_ZK_HOST), (int) parent.getTimeInMillis(Property.INSTANCE_ZK_TIMEOUT));
      instance = new ZooConfiguration(parent);
      @SuppressWarnings("deprecation")
      String deprecatedInstanceIdFromHdfs = ZooKeeperInstance.getInstanceIDFromHdfs(ServerConstants.getInstanceIdLocation());
      instanceId = deprecatedInstanceIdFromHdfs;
    }
View Full Code Here

Examples of org.apache.accumulo.fate.zookeeper.ZooCache

  private static ZooCache getTablePropCache() {
    Instance inst = HdfsZooInstance.getInstance();
    if (tablePropCache == null)
      synchronized (TableConfiguration.class) {
        if (tablePropCache == null)
          tablePropCache = new ZooCache(inst.getZooKeepers(), inst.getZooKeepersSessionTimeOut(), new TableConfWatcher(inst));
      }
    return tablePropCache;
  }
View Full Code Here

Examples of org.apache.accumulo.fate.zookeeper.ZooCache

    int numData = CacheTestWriter.NUM_DATA;
   
    File myfile = new File(reportDir + "/" + UUID.randomUUID());
    myfile.deleteOnExit();
   
    ZooCache zc = new ZooCache(keepers, 30000);
   
    while (true) {
      if (myfile.exists())
        myfile.delete();
     
      if (zc.get(rootDir + "/die") != null) {
        return;
      }
     
      Map<String,String> readData = new TreeMap<String,String>();
     
      for (int i = 0; i < numData; i++) {
        byte[] v = zc.get(rootDir + "/data" + i);
        if (v != null)
          readData.put(rootDir + "/data" + i, new String(v));
      }
     
      byte[] v = zc.get(rootDir + "/dataS");
      if (v != null)
        readData.put(rootDir + "/dataS", new String(v));
     
      List<String> children = zc.getChildren(rootDir + "/dir");
      if (children != null)
        for (String child : children) {
          readData.put(rootDir + "/dir/" + child, "");
        }
     
View Full Code Here

Examples of org.apache.accumulo.fate.zookeeper.ZooCache

  @Override
  public void invalidateCache(Collection<KeyExtent> keySet) {}
 
  @Override
  public void invalidateCache(String server) {
    ZooCache zooCache = zcf.getZooCache(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut());
    String root = ZooUtil.getRoot(instance) + Constants.ZTSERVERS;
    zooCache.clear(root + "/" + server);
  }
View Full Code Here

Examples of org.apache.accumulo.fate.zookeeper.ZooCache

  @Override
  public void invalidateCache() {}
 
  protected TabletLocation getRootTabletLocation() {
    String zRootLocPath = ZooUtil.getRoot(instance) + RootTable.ZROOT_TABLET_LOCATION;
    ZooCache zooCache = zcf.getZooCache(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut());
   
    OpTimer opTimer = new OpTimer(Logger.getLogger(this.getClass()), Level.TRACE).start("Looking up root tablet location in zookeeper.");
    byte[] loc = zooCache.get(zRootLocPath);
    opTimer.stop("Found root tablet at " + (loc == null ? null : new String(loc)) + " in %DURATION%");
   
    if (loc == null) {
      return null;
    }
View Full Code Here

Examples of org.apache.accumulo.fate.zookeeper.ZooCache

    ArgumentChecker.notNull(instance);
    // create list of servers
    ArrayList<ThriftTransportKey> servers = new ArrayList<ThriftTransportKey>();
   
    // add tservers
    ZooCache zc = new ZooCacheFactory().getZooCache(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut());
    for (String tserver : zc.getChildren(ZooUtil.getRoot(instance) + Constants.ZTSERVERS)) {
      String path = ZooUtil.getRoot(instance) + Constants.ZTSERVERS + "/" + tserver;
      byte[] data = ZooUtil.getLockData(zc, path);
      if (data != null && !new String(data, Constants.UTF8).equals("master"))
        servers.add(new ThriftTransportKey(
          new ServerServices(new String(data)).getAddressString(Service.TSERV_CLIENT),
View Full Code Here

Examples of org.apache.accumulo.fate.zookeeper.ZooCache

  private synchronized ZooCachePropertyAccessor getPropCacheAccessor() {
    if (propCacheAccessor == null) {
      synchronized (propCaches) {
        PropCacheKey key = new PropCacheKey(instance.getInstanceID(), table);
        ZooCache propCache = propCaches.get(key);
        if (propCache == null) {
          propCache = zcf.getZooCache(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut(), new TableConfWatcher(instance));
          propCaches.put(key, propCache);
        }
        propCacheAccessor = new ZooCachePropertyAccessor(propCache);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.