gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-17 15:33:31 26 4
gpt4 key购买 nike

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

ZooUtil.retryOrThrow介绍

暂无

代码示例

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

public static boolean isLockHeld(ZooKeeperConnectionInfo info, LockID lid)
  throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   List<String> children = getZooKeeper(info).getChildren(lid.path, false);
   if (children.size() == 0) {
    return false;
   }
   Collections.sort(children);
   String lockNode = children.get(0);
   if (!lid.node.equals(lockNode))
    return false;
   Stat stat = getZooKeeper(info).exists(lid.path + "/" + lid.node, false);
   return stat != null && stat.getEphemeralOwner() == lid.eid;
  } catch (KeeperException ex) {
   final Code c = ex.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, ex);
   }
  }
  retry.waitForNextAttempt();
 }
}

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

public static byte[] getData(ZooKeeperConnectionInfo info, String zPath, Stat stat)
  throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   return getZooKeeper(info).getData(zPath, false, stat);
  } catch (KeeperException e) {
   final Code c = e.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, e);
   } else {
    throw e;
   }
  }
  retry.waitForNextAttempt();
 }
}

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

public static String putEphemeralData(ZooKeeperConnectionInfo info, String zPath, byte[] data)
  throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   return getZooKeeper(info).create(zPath, data, ZooUtil.PUBLIC, CreateMode.EPHEMERAL);
  } catch (KeeperException e) {
   final Code c = e.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, e);
   } else {
    throw e;
   }
  }
  retry.waitForNextAttempt();
 }
}

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

public static Stat getStatus(ZooKeeperConnectionInfo info, String zPath)
  throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   return getZooKeeper(info).exists(zPath, false);
  } catch (KeeperException e) {
   final Code c = e.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, e);
   } else {
    throw e;
   }
  }
  retry.waitForNextAttempt();
 }
}

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

public static String putPersistentSequential(ZooKeeperConnectionInfo info, String zPath,
  byte[] data) throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   return getZooKeeper(info).create(zPath, data, ZooUtil.PUBLIC,
     CreateMode.PERSISTENT_SEQUENTIAL);
  } catch (KeeperException e) {
   final Code c = e.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, e);
   } else {
    throw e;
   }
  }
  retry.waitForNextAttempt();
 }
}

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

public static String putEphemeralSequential(ZooKeeperConnectionInfo info, String zPath,
  byte[] data) throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   return getZooKeeper(info).create(zPath, data, ZooUtil.PUBLIC,
     CreateMode.EPHEMERAL_SEQUENTIAL);
  } catch (KeeperException e) {
   final Code c = e.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, e);
   } else {
    throw e;
   }
  }
  retry.waitForNextAttempt();
 }
}

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

} else if (code2 == Code.CONNECTIONLOSS || code2 == Code.OPERATIONTIMEOUT
      || code2 == Code.SESSIONEXPIRED) {
     retryOrThrow(retry, e2);
     break;
    } else {
 retryOrThrow(retry, e);
} else {

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

public static List<ACL> getACL(ZooKeeperConnectionInfo info, String zPath, Stat stat)
  throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   return getZooKeeper(info).getACL(zPath, stat);
  } catch (KeeperException e) {
   final Code c = e.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, e);
   } else {
    throw e;
   }
  }
  retry.waitForNextAttempt();
 }
}

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

final Code c = e.code();
if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
 retryOrThrow(retry, e);
} else {
 throw e;
final Code c = e.code();
if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
 retryOrThrow(retry, e);
} else {
 throw e;

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

if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT
  || c == Code.SESSIONEXPIRED) {
 retryOrThrow(retry, e);
} else {
 throw e;

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

public static boolean isLockHeld(ZooKeeperConnectionInfo info, LockID lid)
  throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   List<String> children = getZooKeeper(info).getChildren(lid.path, false);
   if (children.size() == 0) {
    return false;
   }
   Collections.sort(children);
   String lockNode = children.get(0);
   if (!lid.node.equals(lockNode))
    return false;
   Stat stat = getZooKeeper(info).exists(lid.path + "/" + lid.node, false);
   return stat != null && stat.getEphemeralOwner() == lid.eid;
  } catch (KeeperException ex) {
   final Code c = ex.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, ex);
   }
  }
  retry.waitForNextAttempt();
 }
}

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

public static byte[] getData(ZooKeeperConnectionInfo info, String zPath, Stat stat)
  throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   return getZooKeeper(info).getData(zPath, false, stat);
  } catch (KeeperException e) {
   final Code c = e.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, e);
   } else {
    throw e;
   }
  }
  retry.waitForNextAttempt();
 }
}

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

public static Stat getStatus(ZooKeeperConnectionInfo info, String zPath)
  throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   return getZooKeeper(info).exists(zPath, false);
  } catch (KeeperException e) {
   final Code c = e.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, e);
   } else {
    throw e;
   }
  }
  retry.waitForNextAttempt();
 }
}

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

public static String putEphemeralData(ZooKeeperConnectionInfo info, String zPath, byte[] data)
  throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   return getZooKeeper(info).create(zPath, data, ZooUtil.PUBLIC, CreateMode.EPHEMERAL);
  } catch (KeeperException e) {
   final Code c = e.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, e);
   } else {
    throw e;
   }
  }
  retry.waitForNextAttempt();
 }
}

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

public static String putPersistentSequential(ZooKeeperConnectionInfo info, String zPath,
  byte[] data) throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   return getZooKeeper(info).create(zPath, data, ZooUtil.PUBLIC,
     CreateMode.PERSISTENT_SEQUENTIAL);
  } catch (KeeperException e) {
   final Code c = e.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, e);
   } else {
    throw e;
   }
  }
  retry.waitForNextAttempt();
 }
}

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

public static String putEphemeralSequential(ZooKeeperConnectionInfo info, String zPath,
  byte[] data) throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   return getZooKeeper(info).create(zPath, data, ZooUtil.PUBLIC,
     CreateMode.EPHEMERAL_SEQUENTIAL);
  } catch (KeeperException e) {
   final Code c = e.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, e);
   } else {
    throw e;
   }
  }
  retry.waitForNextAttempt();
 }
}

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

} else if (code2 == Code.CONNECTIONLOSS || code2 == Code.OPERATIONTIMEOUT
      || code2 == Code.SESSIONEXPIRED) {
     retryOrThrow(retry, e2);
     break;
    } else {
 retryOrThrow(retry, e);
} else {

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

public static List<ACL> getACL(ZooKeeperConnectionInfo info, String zPath, Stat stat)
  throws KeeperException, InterruptedException {
 final Retry retry = RETRY_FACTORY.createRetry();
 while (true) {
  try {
   return getZooKeeper(info).getACL(zPath, stat);
  } catch (KeeperException e) {
   final Code c = e.code();
   if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
    retryOrThrow(retry, e);
   } else {
    throw e;
   }
  }
  retry.waitForNextAttempt();
 }
}

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

final Code c = e.code();
if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
 retryOrThrow(retry, e);
} else {
 throw e;
final Code c = e.code();
if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT || c == Code.SESSIONEXPIRED) {
 retryOrThrow(retry, e);
} else {
 throw e;

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

if (c == Code.CONNECTIONLOSS || c == Code.OPERATIONTIMEOUT
  || c == Code.SESSIONEXPIRED) {
 retryOrThrow(retry, e);
} else {
 throw e;

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