Package org.apache.bookkeeper.client

Examples of org.apache.bookkeeper.client.SyncCounter


   *          ledger handle
   * @param ctx
   *          optional control object
   */
  public void openComplete(int rc, LedgerHandle lh, Object ctx) {
    SyncCounter counter = (SyncCounter) ctx;
    counter.setLh(lh);

    LOG.debug("Open complete: " + rc);

    counter.setrc(rc);
    counter.dec();
  }
View Full Code Here


   * @throws BKException
   */

  public LedgerHandle openLedger(long lId, DigestType digestType, byte passwd[])
      throws BKException, InterruptedException {
    SyncCounter counter = new SyncCounter();
    counter.inc();

    /*
     * Calls async open ledger
     */
    asyncOpenLedger(lId, digestType, passwd, this, counter);

    /*
     * Wait
     */
    counter.block(0);
    if (counter.getrc() != BKException.Code.OK)
      throw BKException.create(counter.getrc());

    return counter.getLh();
  }
View Full Code Here

   *          ledger handle object
   * @param ctx
   *          optional control object
   */
  public void createComplete(int rc, LedgerHandle lh, Object ctx) {
    SyncCounter counter = (SyncCounter) ctx;
    counter.setLh(lh);
    counter.setrc(rc);
    counter.dec();
  }
View Full Code Here

   * @throws BKException
   */
  public LedgerHandle createLedger(int ensSize, int qSize,
      DigestType digestType, byte passwd[]) throws KeeperException,
      InterruptedException, IOException, BKException {
    SyncCounter counter = new SyncCounter();
    counter.inc();
    /*
     * Calls asynchronous version
     */
    asyncCreateLedger(ensSize, qSize, digestType, passwd, this, counter);

    /*
     * Wait
     */
    counter.block(0);
    if (counter.getLh() == null) {
      LOG.error("ZooKeeper error: " + counter.getrc());
      throw BKException.create(Code.ZKException);
    }

    return counter.getLh();
  }
View Full Code Here

   *          ledger handle object
   * @param ctx
   *          optional control object
   */
  public void createComplete(int rc, LedgerHandle lh, Object ctx) {
    SyncCounter counter = (SyncCounter) ctx;
    counter.setLh(lh);
    counter.setrc(rc);
    counter.dec();
  }
View Full Code Here

   * @throws BKException
   */
  public LedgerHandle createLedger(int ensSize, int qSize,
      DigestType digestType, byte passwd[]) throws KeeperException,
      InterruptedException, IOException, BKException {
    SyncCounter counter = new SyncCounter();
    counter.inc();
    /*
     * Calls asynchronous version
     */
    asyncCreateLedger(ensSize, qSize, digestType, passwd, this, counter);

    /*
     * Wait
     */
    counter.block(0);
    if (counter.getLh() == null) {
      LOG.error("ZooKeeper error: " + counter.getrc());
      throw BKException.create(Code.ZKException);
    }

    return counter.getLh();
  }
View Full Code Here

   *          ledger handle
   * @param ctx
   *          optional control object
   */
  public void openComplete(int rc, LedgerHandle lh, Object ctx) {
    SyncCounter counter = (SyncCounter) ctx;
    counter.setLh(lh);

    LOG.debug("Open complete: " + rc);

    counter.setrc(rc);
    counter.dec();
  }
View Full Code Here

   * @throws BKException
   */

  public LedgerHandle openLedger(long lId, DigestType digestType, byte passwd[])
      throws BKException, InterruptedException {
    SyncCounter counter = new SyncCounter();
    counter.inc();

    /*
     * Calls async open ledger
     */
    asyncOpenLedger(lId, digestType, passwd, this, counter);

    /*
     * Wait
     */
    counter.block(0);
    if (counter.getrc() != BKException.Code.OK)
      throw BKException.create(counter.getrc());

    return counter.getLh();
  }
View Full Code Here

TOP

Related Classes of org.apache.bookkeeper.client.SyncCounter

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.