コード例 #1
0
ファイル: DataTree.java プロジェクト: gildafnai82/craq
 /**
  * this method traverses the quota path and update the path trie and sets
  *
  * @param path
  */
 private void traverseNode(String path) {
   DataNode node = getNode(path);
   String children[] = null;
   synchronized (node) {
     children = node.children.toArray(new String[node.children.size()]);
   }
   if (children.length == 0) {
     // this node does not have a child
     // is the leaf node
     // check if its the leaf node
     String endString = "/" + Quotas.limitNode;
     if (path.endsWith(endString)) {
       // ok this is the limit node
       // get the real node and update
       // the count and the bytes
       String realPath = path.substring(Quotas.quotaZookeeper.length(), path.indexOf(endString));
       updateQuotaForPath(realPath);
       this.pTrie.addPath(realPath);
     }
     return;
   }
   for (String child : children) {
     traverseNode(path + "/" + child);
   }
 }
コード例 #2
0
ファイル: DataTree.java プロジェクト: gildafnai82/craq
 /** this method sets up the path trie and sets up stats for quota nodes */
 private void setupQuota() {
   String quotaPath = Quotas.quotaZookeeper;
   DataNode node = getNode(quotaPath);
   if (node == null) {
     return;
   }
   traverseNode(quotaPath);
 }