当前位置: 首页>>代码示例>>Java>>正文


Java CreateCallback类代码示例

本文整理汇总了Java中org.apache.bookkeeper.client.AsyncCallback.CreateCallback的典型用法代码示例。如果您正苦于以下问题:Java CreateCallback类的具体用法?Java CreateCallback怎么用?Java CreateCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CreateCallback类属于org.apache.bookkeeper.client.AsyncCallback包,在下文中一共展示了CreateCallback类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: asyncCreateLedger

import org.apache.bookkeeper.client.AsyncCallback.CreateCallback; //导入依赖的package包/类
@Override
public void asyncCreateLedger(int ensSize, int writeQuorumSize, int ackQuorumSize, final DigestType digestType,
        final byte[] passwd, final CreateCallback cb, final Object ctx) {
    if (stopped.get()) {
        cb.createComplete(BKException.Code.WriteException, null, ctx);
        return;
    }

    executor.execute(new Runnable() {
        public void run() {
            if (getProgrammedFailStatus()) {
                if (failReturnCode != BkTimeoutOperation) {
                    cb.createComplete(failReturnCode, null, ctx);
                }
                return;
            }

            if (stopped.get()) {
                cb.createComplete(BKException.Code.WriteException, null, ctx);
                return;
            }

            try {
                long id = sequence.getAndIncrement();
                log.info("Creating ledger {}", id);
                MockLedgerHandle lh = new MockLedgerHandle(MockBookKeeper.this, id, digestType, passwd);
                ledgers.put(id, lh);
                cb.createComplete(0, lh, ctx);
            } catch (Throwable t) {
            }
        }
    });
}
 
开发者ID:apache,项目名称:incubator-pulsar,代码行数:34,代码来源:MockBookKeeper.java

示例2: asyncCreateLedger

import org.apache.bookkeeper.client.AsyncCallback.CreateCallback; //导入依赖的package包/类
/**
 * Creates a new ledger asynchronously. To create a ledger, we need to specify
 * the ensemble size, the quorum size, the digest type, a password, a callback
 * implementation, and an optional control object. The ensemble size is how
 * many bookies the entries should be striped among and the quorum size is the
 * degree of replication of each entry. The digest type is either a MAC or a
 * CRC. Note that the CRC option is not able to protect a client against a
 * bookie that replaces an entry. The password is used not only to
 * authenticate access to a ledger, but also to verify entries in ledgers.
 * 
 * @param ensSize
 *          ensemble size
 * @param qSize
 *          quorum size
 * @param digestType
 *          digest type, either MAC or CRC32
 * @param passwd
 *          password
 * @param cb
 *          createCallback implementation
 * @param ctx
 *          optional control object
 */
public void asyncCreateLedger(int ensSize, int qSize, DigestType digestType,
    byte[] passwd, CreateCallback cb, Object ctx) {

  new LedgerCreateOp(this, ensSize, qSize, digestType, passwd, cb, ctx)
      .initiate();

}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:31,代码来源:BookKeeper.java

示例3: LedgerCreateOp

import org.apache.bookkeeper.client.AsyncCallback.CreateCallback; //导入依赖的package包/类
/**
* Constructor
* 
* @param bk
*       BookKeeper object
* @param ensembleSize
*       ensemble size
* @param quorumSize
*       quorum size
* @param digestType
*       digest type, either MAC or CRC32
* @param passwd
*       passowrd
* @param cb
*       callback implementation
* @param ctx
*       optional control object
*/

LedgerCreateOp(BookKeeper bk, int ensembleSize, int quorumSize, DigestType digestType, byte[] passwd, CreateCallback cb, Object ctx) {
    this.bk = bk;
    this.metadata = new LedgerMetadata(ensembleSize, quorumSize);
    this.digestType = digestType;
    this.passwd = passwd;
    this.cb = cb;
    this.ctx = ctx;
}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:28,代码来源:LedgerCreateOp.java


注:本文中的org.apache.bookkeeper.client.AsyncCallback.CreateCallback类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。