Package com.cloudera.util

Examples of com.cloudera.util.FixedRetryPolicy


          initCallback.success(ZKClient.this);
        }
        return true;
      };
    };
    RetryHarness harness = new RetryHarness(retry, new FixedRetryPolicy(3),
        true);

    try {
      return harness.attempt();
    } catch (IOException i) {
View Full Code Here


   * already exists, will not try to set the data.
   */
  public boolean ensureExists(final String path, final byte[] data)
      throws KeeperException, IOException, InterruptedException {
    Preconditions.checkArgument(zk != null);
    final FixedRetryPolicy policy = new FixedRetryPolicy(3);
    if (zk.exists(path, false) != null) {
      return true;
    }
    ZKRetryable<Boolean> retry = new ZKRetryable<Boolean>() {
      public boolean doTry() throws Exception {
View Full Code Here

   * Ensure that the given path is deleted, whether or not we did it.
   */
  public void ensureDeleted(final String path, final int version)
      throws KeeperException, IOException, InterruptedException {
    Preconditions.checkArgument(zk != null);
    final FixedRetryPolicy policy = new FixedRetryPolicy(3);
    ZKRetryable<Void> retry = new ZKRetryable<Void>() {
      public boolean doTry() throws Exception {
        try {
          zk.delete(path, version);
          return true;
View Full Code Here

   */
  public String getLastSequentialChild(final String path, final String prefix,
      final boolean watch) throws IOException, KeeperException,
      InterruptedException {
    Preconditions.checkArgument(zk != null);
    final FixedRetryPolicy policy = new FixedRetryPolicy(3);

    ZKRetryable<String> retry = new ZKRetryable<String>() {
      public boolean doTry() throws Exception {
        result = null;
        List<String> children = null;
View Full Code Here

  // Implementations of common ZK APIs
  public List<String> getChildren(final String path, final boolean watch)
      throws IOException, KeeperException, InterruptedException {
    Preconditions.checkArgument(zk != null);
    final FixedRetryPolicy policy = new FixedRetryPolicy(3);
    ZKRetryable<List<String>> retry = new ZKRetryable<List<String>>() {
      public boolean doTry() throws Exception {
        try {
          result = zk.getChildren(path, watch);
        } catch (KeeperException k) {
View Full Code Here

  }

  public byte[] getData(final String path, final boolean watch, final Stat stat)
      throws IOException, KeeperException, InterruptedException {
    Preconditions.checkArgument(zk != null);
    final FixedRetryPolicy policy = new FixedRetryPolicy(3);
    ZKRetryable<byte[]> retry = new ZKRetryable<byte[]>() {
      public boolean doTry() throws Exception {
        try {
          result = zk.getData(path, watch, stat);
        } catch (KeeperException k) {
View Full Code Here

  }

  public Stat setData(final String path, final byte[] data, final int version)
      throws IOException, KeeperException, InterruptedException {
    Preconditions.checkArgument(zk != null);
    final FixedRetryPolicy policy = new FixedRetryPolicy(3);
    ZKRetryable<Stat> retry = new ZKRetryable<Stat>() {
      public boolean doTry() throws Exception {
        try {
          result = zk.setData(path, data, version);
        } catch (KeeperException k) {
View Full Code Here

  public String create(final String path, final byte[] data,
      final List<ACL> acls, final CreateMode mode) throws IOException,
      KeeperException, InterruptedException {
    Preconditions.checkArgument(zk != null);
    final FixedRetryPolicy policy = new FixedRetryPolicy(3);
    ZKRetryable<String> retry = new ZKRetryable<String>() {
      public boolean doTry() throws IOException, KeeperException,
          InterruptedException {
        try {
          result = zk.create(path, data, acls, mode);
View Full Code Here

  }

  public void delete(final String path, final int version) throws IOException,
      KeeperException, InterruptedException {
    Preconditions.checkArgument(zk != null);
    final FixedRetryPolicy policy = new FixedRetryPolicy(3);
    ZKRetryable<Void> retry = new ZKRetryable<Void>() {
      public boolean doTry() throws IOException, KeeperException,
          InterruptedException {
        try {
          zk.delete(path, version);
View Full Code Here

  }

  public Stat exists(final String path, final boolean watch)
      throws IOException, KeeperException, InterruptedException {
    Preconditions.checkArgument(zk != null);
    final FixedRetryPolicy policy = new FixedRetryPolicy(3);
    ZKRetryable<Stat> retry = new ZKRetryable<Stat>() {
      public boolean doTry() throws IOException, KeeperException,
          InterruptedException {
        try {
          result = zk.exists(path, watch);
View Full Code Here

TOP

Related Classes of com.cloudera.util.FixedRetryPolicy

Copyright © 2018 www.massapicom. 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.