當前位置: 首頁>>代碼示例>>Java>>正文


Java Code.get方法代碼示例

本文整理匯總了Java中org.apache.zookeeper.KeeperException.Code.get方法的典型用法代碼示例。如果您正苦於以下問題:Java Code.get方法的具體用法?Java Code.get怎麽用?Java Code.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.zookeeper.KeeperException.Code的用法示例。


在下文中一共展示了Code.get方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processResult

import org.apache.zookeeper.KeeperException.Code; //導入方法依賴的package包/類
public void processResult(int rc, String path, Object ctx,
        List<ACL> acl, Stat stat)
{
    this.acl = acl;
    this.stat = stat;
    super.processResult(Code.get(rc), path, ctx);
}
 
開發者ID:maoling,項目名稱:fuck_zookeeper,代碼行數:8,代碼來源:AsyncOps.java

示例2: processResult

import org.apache.zookeeper.KeeperException.Code; //導入方法依賴的package包/類
public void processResult(int rc, String path, Object ctx, byte[] data,
        Stat stat)
{
    this.data = data;
    this.stat = stat;
    super.processResult(Code.get(rc), path, ctx);
}
 
開發者ID:l294265421,項目名稱:ZooKeeper,代碼行數:8,代碼來源:AsyncOps.java

示例3: processResult

import org.apache.zookeeper.KeeperException.Code; //導入方法依賴的package包/類
public void processResult(int rc, String path, Object ctx,
        List<String> children)
{
    this.children =
        (children == null ? new ArrayList<String>() : children);
    Collections.sort(this.children);
    super.processResult(Code.get(rc), path, ctx);
}
 
開發者ID:didichuxing2,項目名稱:https-github.com-apache-zookeeper,代碼行數:9,代碼來源:AsyncOps.java

示例4: processResult

import org.apache.zookeeper.KeeperException.Code; //導入方法依賴的package包/類
/**
 * interface implementation of Zookeeper callback for create
 */
@Override
public synchronized void processResult(int rc, String path, Object ctx,
    String name) {
  if (isStaleClient(ctx)) return;
  if (LOG.isDebugEnabled()) {
    LOG.debug("CreateNode result: " + rc + " for path: " + path
        + " connectionState: " + zkConnectionState +
        "  for " + this);
  }

  Code code = Code.get(rc);
  if (isSuccess(code)) {
    // we successfully created the znode. we are the leader. start monitoring
    if (becomeActive()) {
      monitorActiveStatus();
    } else {
      reJoinElectionAfterFailureToBecomeActive();
    }
    return;
  }

  if (isNodeExists(code)) {
    if (createRetryCount == 0) {
      // znode exists and we did not retry the operation. so a different
      // instance has created it. become standby and monitor lock.
      becomeStandby();
    }
    // if we had retried then the znode could have been created by our first
    // attempt to the server (that we lost) and this node exists response is
    // for the second attempt. verify this case via ephemeral node owner. this
    // will happen on the callback for monitoring the lock.
    monitorActiveStatus();
    return;
  }

  String errorMessage = "Received create error from Zookeeper. code:"
      + code.toString() + " for path " + path;
  LOG.debug(errorMessage);

  if (shouldRetry(code)) {
    if (createRetryCount < maxRetryNum) {
      LOG.debug("Retrying createNode createRetryCount: " + createRetryCount);
      ++createRetryCount;
      createLockNodeAsync();
      return;
    }
    errorMessage = errorMessage
        + ". Not retrying further znode create connection errors.";
  } else if (isSessionExpired(code)) {
    // This isn't fatal - the client Watcher will re-join the election
    LOG.warn("Lock acquisition failed because session was lost");
    return;
  }

  fatalError(errorMessage);
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:60,代碼來源:ActiveStandbyElector.java


注:本文中的org.apache.zookeeper.KeeperException.Code.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。