Codota Logo
MetaStore$MetaStoreCallback.operationComplete
Code IndexAdd Codota to your IDE (free)

How to use
operationComplete
method
in
org.apache.bookkeeper.mledger.impl.MetaStore$MetaStoreCallback

Best Java code snippets using org.apache.bookkeeper.mledger.impl.MetaStore$MetaStoreCallback.operationComplete (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: apache/pulsar

@Override
public void getCursors(final String ledgerName, final MetaStoreCallback<List<String>> callback) {
  if (log.isDebugEnabled()) {
    log.debug("[{}] Get cursors list", ledgerName);
  }
  zk.getChildren(prefix + ledgerName, false,
      (rc, path, ctx, children, stat) -> executor.executeOrdered(ledgerName, safeRun(() -> {
    if (log.isDebugEnabled()) {
      log.debug("[{}] getConsumers complete rc={} children={}", ledgerName, Code.get(rc), children);
    }
    if (rc != Code.OK.intValue()) {
      callback.operationFailed(new MetaStoreException(KeeperException.create(Code.get(rc))));
      return;
    }
    if (log.isDebugEnabled()) {
      log.debug("[{}] Get childrend completed version={}", ledgerName, stat.getVersion());
    }
    callback.operationComplete(children, new ZKStat(stat));
  })), null);
}
origin: apache/pulsar

@Override
public void asyncGetCursorInfo(String ledgerName, String consumerName,
    final MetaStoreCallback<ManagedCursorInfo> callback) {
  String path = prefix + ledgerName + "/" + consumerName;
  if (log.isDebugEnabled()) {
    log.debug("Reading from {}", path);
  }
  zk.getData(path, false, (rc, path1, ctx, data, stat) -> executor.executeOrdered(ledgerName, safeRun(() -> {
    if (rc != Code.OK.intValue()) {
      callback.operationFailed(new MetaStoreException(KeeperException.create(Code.get(rc))));
    } else {
      try {
        ManagedCursorInfo info = parseManagedCursorInfo(data);
        callback.operationComplete(info, new ZKStat(stat));
      } catch (ParseException | InvalidProtocolBufferException e) {
        callback.operationFailed(new MetaStoreException(e));
      }
    }
  })), null);
  if (log.isDebugEnabled()) {
    log.debug("Reading from {} ok", path);
  }
}
origin: apache/pulsar

@Override
public void removeManagedLedger(String ledgerName, MetaStoreCallback<Void> callback) {
  log.info("[{}] Remove ManagedLedger", ledgerName);
  zk.delete(prefix + ledgerName, -1, (rc, path, ctx) -> executor.executeOrdered(ledgerName, safeRun(() -> {
    if (log.isDebugEnabled()) {
      log.debug("[{}] zk delete done. rc={}", ledgerName, Code.get(rc));
    }
    if (rc == Code.OK.intValue()) {
      callback.operationComplete(null, null);
    } else {
      callback.operationFailed(new MetaStoreException(KeeperException.create(Code.get(rc))));
    }
  })), null);
}
origin: apache/pulsar

  public Object answer(InvocationOnMock invocation) {
    ManagedCursorInfo info = ManagedCursorInfo.newBuilder().setCursorsLedgerId(cursorsLedgerId)
        .setMarkDeleteLedgerId(markDeleteLedgerId).setMarkDeleteEntryId(markDeleteEntryId)
        .setLastActive(0L).build();
    Stat stat = mock(Stat.class);
    MetaStoreCallback<ManagedCursorInfo> callback = (MetaStoreCallback<ManagedCursorInfo>) invocation
        .getArguments()[2];
    callback.operationComplete(info, stat);
    return null;
  }
}).when(mockMetaStore).asyncGetCursorInfo(eq(mlName), eq(cursorName), any(MetaStoreCallback.class));
origin: apache/pulsar

@Override
public void asyncUpdateLedgerIds(String ledgerName, ManagedLedgerInfo mlInfo, Stat stat,
    final MetaStoreCallback<Void> callback) {
  ZKStat zkStat = (ZKStat) stat;
  if (log.isDebugEnabled()) {
    log.debug("[{}] Updating metadata version={} with content={}", ledgerName, zkStat.version, mlInfo);
  }
  byte[] serializedMlInfo = mlInfo.toByteArray(); // Binary format
  zk.setData(prefix + ledgerName, serializedMlInfo, zkStat.getVersion(),
      (rc, path, zkCtx, stat1) -> executor.executeOrdered(ledgerName, safeRun(() -> {
        if (log.isDebugEnabled()) {
          log.debug("[{}] UpdateLedgersIdsCallback.processResult rc={} newVersion={}", ledgerName,
              Code.get(rc), stat != null ? stat.getVersion() : "null");
        }
        MetaStoreException status = null;
        if (rc == Code.BADVERSION.intValue()) {
          // Content has been modified on ZK since our last read
          status = new BadVersionException(KeeperException.create(Code.get(rc)));
          callback.operationFailed(status);
        } else if (rc != Code.OK.intValue()) {
          status = new MetaStoreException(KeeperException.create(Code.get(rc)));
          callback.operationFailed(status);
        } else {
          callback.operationComplete(null, new ZKStat(stat1));
        }
      })), null);
}
origin: apache/pulsar

  ManagedLedgerInfo info = parseManagedLedgerInfo(readData);
  info = updateMLInfoTimestamp(info);
  callback.operationComplete(info, new ZKStat(stat));
} catch (ParseException | InvalidProtocolBufferException e) {
  callback.operationFailed(new MetaStoreException(e));
    if (rc1 == Code.OK.intValue()) {
      ManagedLedgerInfo info = ManagedLedgerInfo.getDefaultInstance();
      callback.operationComplete(info, new ZKStat());
    } else {
      callback.operationFailed(
origin: apache/pulsar

            info);
      callback.operationComplete(null, new ZKStat());
  callback.operationFailed(new MetaStoreException(KeeperException.create(Code.get(rc))));
} else {
  callback.operationComplete(null, new ZKStat(stat1));
origin: org.apache.pulsar/managed-ledger-original

@Override
public void operationComplete(Void result, Stat stat) {
  cursorLedgerStat = stat;
  callback.operationComplete(result, stat);
}
origin: org.apache.pulsar/managed-ledger-original

@Override
public void removeManagedLedger(String ledgerName, MetaStoreCallback<Void> callback) {
  log.info("[{}] Remove ManagedLedger", ledgerName);
  zk.delete(prefix + ledgerName, -1, (rc, path, ctx) -> executor.executeOrdered(ledgerName, safeRun(() -> {
    if (log.isDebugEnabled()) {
      log.debug("[{}] zk delete done. rc={}", ledgerName, Code.get(rc));
    }
    if (rc == Code.OK.intValue()) {
      callback.operationComplete(null, null);
    } else {
      callback.operationFailed(new MetaStoreException(KeeperException.create(Code.get(rc))));
    }
  })), null);
}
origin: com.yahoo.pulsar/managed-ledger

@Override
public void asyncRemoveCursor(final String ledgerName, final String consumerName,
    final MetaStoreCallback<Void> callback) {
  log.info("[{}] Remove consumer={}", ledgerName, consumerName);
  zk.delete(prefix + ledgerName + "/" + consumerName, -1, (rc, path, ctx) -> executor.submit(safeRun(() -> {
    if (log.isDebugEnabled()) {
      log.debug("[{}] [{}] zk delete done. rc={}", ledgerName, consumerName, Code.get(rc));
    }
    if (rc == Code.OK.intValue()) {
      callback.operationComplete(null, null);
    } else {
      callback.operationFailed(new MetaStoreException(KeeperException.create(Code.get(rc))));
    }
  })), null);
}
origin: com.yahoo.pulsar/managed-ledger

@Override
public void removeManagedLedger(String ledgerName, MetaStoreCallback<Void> callback) {
  log.info("[{}] Remove ManagedLedger", ledgerName);
  zk.delete(prefix + ledgerName, -1, (rc, path, ctx) -> executor.submit(safeRun(() -> {
    if (log.isDebugEnabled()) {
      log.debug("[{}] zk delete done. rc={}", ledgerName, Code.get(rc));
    }
    if (rc == Code.OK.intValue()) {
      callback.operationComplete(null, null);
    } else {
      callback.operationFailed(new MetaStoreException(KeeperException.create(Code.get(rc))));
    }
  })), null);
}
origin: org.apache.pulsar/managed-ledger-original

@Override
public void asyncRemoveCursor(final String ledgerName, final String consumerName,
    final MetaStoreCallback<Void> callback) {
  log.info("[{}] Remove consumer={}", ledgerName, consumerName);
  zk.delete(prefix + ledgerName + "/" + consumerName, -1,
      (rc, path, ctx) -> executor.executeOrdered(ledgerName, safeRun(() -> {
    if (log.isDebugEnabled()) {
      log.debug("[{}] [{}] zk delete done. rc={}", ledgerName, consumerName, Code.get(rc));
    }
    if (rc == Code.OK.intValue()) {
      callback.operationComplete(null, null);
    } else {
      callback.operationFailed(new MetaStoreException(KeeperException.create(Code.get(rc))));
    }
  })), null);
}
origin: org.apache.pulsar/managed-ledger-original

@Override
public void getCursors(final String ledgerName, final MetaStoreCallback<List<String>> callback) {
  if (log.isDebugEnabled()) {
    log.debug("[{}] Get cursors list", ledgerName);
  }
  zk.getChildren(prefix + ledgerName, false,
      (rc, path, ctx, children, stat) -> executor.executeOrdered(ledgerName, safeRun(() -> {
    if (log.isDebugEnabled()) {
      log.debug("[{}] getConsumers complete rc={} children={}", ledgerName, Code.get(rc), children);
    }
    if (rc != Code.OK.intValue()) {
      callback.operationFailed(new MetaStoreException(KeeperException.create(Code.get(rc))));
      return;
    }
    if (log.isDebugEnabled()) {
      log.debug("[{}] Get childrend completed version={}", ledgerName, stat.getVersion());
    }
    callback.operationComplete(children, new ZKStat(stat));
  })), null);
}
origin: com.yahoo.pulsar/managed-ledger

@Override
public void getCursors(final String ledgerName, final MetaStoreCallback<List<String>> callback) {
  if (log.isDebugEnabled()) {
    log.debug("[{}] Get cursors list", ledgerName);
  }
  zk.getChildren(prefix + ledgerName, false, (rc, path, ctx, children, stat) -> executor.submit(safeRun(() -> {
    if (log.isDebugEnabled()) {
      log.debug("[{}] getConsumers complete rc={} children={}", ledgerName, Code.get(rc), children);
    }
    if (rc != Code.OK.intValue()) {
      callback.operationFailed(new MetaStoreException(KeeperException.create(Code.get(rc))));
      return;
    }
    if (log.isDebugEnabled()) {
      log.debug("[{}] Get childrend completed version={}", ledgerName, stat.getVersion());
    }
    callback.operationComplete(children, new ZKStat(stat));
  })), null);
}
origin: apache/pulsar

@Override
public void asyncRemoveCursor(final String ledgerName, final String consumerName,
    final MetaStoreCallback<Void> callback) {
  log.info("[{}] Remove consumer={}", ledgerName, consumerName);
  zk.delete(prefix + ledgerName + "/" + consumerName, -1,
      (rc, path, ctx) -> executor.executeOrdered(ledgerName, safeRun(() -> {
    if (log.isDebugEnabled()) {
      log.debug("[{}] [{}] zk delete done. rc={}", ledgerName, consumerName, Code.get(rc));
    }
    if (rc == Code.OK.intValue()) {
      callback.operationComplete(null, null);
    } else {
      callback.operationFailed(new MetaStoreException(KeeperException.create(Code.get(rc))));
    }
  })), null);
}
origin: org.apache.pulsar/managed-ledger-original

@Override
public void asyncGetCursorInfo(String ledgerName, String consumerName,
    final MetaStoreCallback<ManagedCursorInfo> callback) {
  String path = prefix + ledgerName + "/" + consumerName;
  if (log.isDebugEnabled()) {
    log.debug("Reading from {}", path);
  }
  zk.getData(path, false, (rc, path1, ctx, data, stat) -> executor.executeOrdered(ledgerName, safeRun(() -> {
    if (rc != Code.OK.intValue()) {
      callback.operationFailed(new MetaStoreException(KeeperException.create(Code.get(rc))));
    } else {
      try {
        ManagedCursorInfo info = parseManagedCursorInfo(data);
        callback.operationComplete(info, new ZKStat(stat));
      } catch (ParseException | InvalidProtocolBufferException e) {
        callback.operationFailed(new MetaStoreException(e));
      }
    }
  })), null);
  if (log.isDebugEnabled()) {
    log.debug("Reading from {} ok", path);
  }
}
origin: com.yahoo.pulsar/managed-ledger

@Override
public void getManagedLedgerInfo(final String ledgerName, final MetaStoreCallback<ManagedLedgerInfo> callback) {
  // Try to get the content or create an empty node
  zk.getData(prefix + ledgerName, false, (rc, path, ctx, readData, stat) -> executor.submit(safeRun(() -> {
    if (rc == Code.OK.intValue()) {
      try {
        ManagedLedgerInfo info = parseManagedLedgerInfo(readData);
        info = updateMLInfoTimestamp(info);
        callback.operationComplete(info, new ZKStat(stat));
      } catch (ParseException | InvalidProtocolBufferException e) {
        callback.operationFailed(new MetaStoreException(e));
      }
    } else if (rc == Code.NONODE.intValue()) {
      log.info("Creating '{}{}'", prefix, ledgerName);
      StringCallback createcb = (rc1, path1, ctx1, name) -> {
        if (rc1 == Code.OK.intValue()) {
          ManagedLedgerInfo info = ManagedLedgerInfo.getDefaultInstance();
          callback.operationComplete(info, new ZKStat());
        } else {
          callback.operationFailed(new MetaStoreException(KeeperException.create(Code.get(rc1))));
        }
      };
      ZkUtils.asyncCreateFullPathOptimistic(zk, prefix + ledgerName, new byte[0], Acl, CreateMode.PERSISTENT,
          createcb, null);
    } else {
      callback.operationFailed(new MetaStoreException(KeeperException.create(Code.get(rc))));
    }
  })), null);
}
origin: apache/pulsar

@Override
public void operationComplete(Void result, Stat stat) {
  cursorLedgerStat = stat;
  callback.operationComplete(result, stat);
}
origin: com.yahoo.pulsar/managed-ledger

@Override
public void asyncGetCursorInfo(String ledgerName, String consumerName,
    final MetaStoreCallback<ManagedCursorInfo> callback) {
  String path = prefix + ledgerName + "/" + consumerName;
  if (log.isDebugEnabled()) {
    log.debug("Reading from {}", path);
  }
  zk.getData(path, false, (rc, path1, ctx, data, stat) -> executor.submit(safeRun(() -> {
    if (rc != Code.OK.intValue()) {
      callback.operationFailed(new MetaStoreException(KeeperException.create(Code.get(rc))));
    } else {
      try {
        ManagedCursorInfo info = parseManagedCursorInfo(data);
        callback.operationComplete(info, new ZKStat(stat));
      } catch (ParseException | InvalidProtocolBufferException e) {
        callback.operationFailed(new MetaStoreException(e));
      }
    }
  })), null);
  if (log.isDebugEnabled()) {
    log.debug("Reading from {} ok", path);
  }
}
origin: com.yahoo.pulsar/managed-ledger

@Override
public void operationComplete(Void result, Stat stat) {
  callback.operationComplete(result, stat);
}
org.apache.bookkeeper.mledger.implMetaStore$MetaStoreCallbackoperationComplete

Popular methods of MetaStore$MetaStoreCallback

  • operationFailed

Popular in Java

  • Finding current android device location
  • onRequestPermissionsResult (Fragment)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • notifyDataSetChanged (ArrayAdapter)
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Locale (java.util)
    A Locale object represents a specific geographical, political, or cultural region. An operation that
  • ConcurrentHashMap (java.util.concurrent)
    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updat
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • JOptionPane (javax.swing)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now