当前位置: 首页>>代码示例>>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;未经允许,请勿转载。