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


Java ClientConfiguration.setThrottleValue方法代码示例

本文整理汇总了Java中org.apache.bookkeeper.conf.ClientConfiguration.setThrottleValue方法的典型用法代码示例。如果您正苦于以下问题:Java ClientConfiguration.setThrottleValue方法的具体用法?Java ClientConfiguration.setThrottleValue怎么用?Java ClientConfiguration.setThrottleValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.bookkeeper.conf.ClientConfiguration的用法示例。


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

示例1: ReplicatedCommitLog

import org.apache.bookkeeper.conf.ClientConfiguration; //导入方法依赖的package包/类
public ReplicatedCommitLog(String zkAddress, int zkTimeout, String zkPath, Path snapshotsDirectory, byte[] localhostdata,
    boolean writeacls, Map<String, String> bookkeeperConfiguration) throws Exception {
    if (localhostdata == null) {
        localhostdata = new byte[0];
    }
    ClientConfiguration config = new ClientConfiguration();
    config.setEnableParallelRecoveryRead(true);
    config.setThrottleValue(0);
    config.setEnableDigestTypeAutodetection(true);
    bookkeeperConfiguration.forEach((k, v) -> {
        LOGGER.log(Level.INFO, "extra bookkeeper client property " + k + "=" + v);
        config.setProperty(k, v);
    });
    try {
        this.zKClusterManager = new ZKClusterManager(zkAddress, zkTimeout, zkPath, leaderShiplistener, localhostdata, writeacls);
        this.zKClusterManager.waitForConnection();
        this.bookKeeper = new BookKeeper(config, zKClusterManager.getZooKeeper());
        this.snapshotsDirectory = snapshotsDirectory;
        this.zKClusterManager.start();
    } catch (Exception t) {
        close();
        throw t;
    }
}
 
开发者ID:diennea,项目名称:majordodo,代码行数:25,代码来源:ReplicatedCommitLog.java

示例2: createBookKeeper

import org.apache.bookkeeper.conf.ClientConfiguration; //导入方法依赖的package包/类
private BookKeeper createBookKeeper() throws Exception {
    byte[] localhostdata = BrokerHostData.formatHostdata(new BrokerHostData(broker1Host, broker1Port, "", false, null));
    ClientConfiguration config = new ClientConfiguration();
    config.setThrottleValue(0);

    ZKClusterManager zkClusterManager = new ZKClusterManager(zkServer.getAddress(), zkServer.getTimeout(), zkServer.getPath(), leaderShiplistener, localhostdata, false);
    zkClusterManager.waitForConnection();
    BookKeeper bookKeeper = new BookKeeper(config, zkClusterManager.getZooKeeper());
    zkClusterManager.start();

    return bookKeeper;
}
 
开发者ID:diennea,项目名称:majordodo,代码行数:13,代码来源:BookkeeperFailuresTest.java

示例3: create

import org.apache.bookkeeper.conf.ClientConfiguration; //导入方法依赖的package包/类
@Override
public BookKeeper create(ServiceConfiguration conf, ZooKeeper zkClient) throws IOException {
    ClientConfiguration bkConf = new ClientConfiguration();

    if (conf.getBookkeeperClientAuthenticationPlugin() != null
            && conf.getBookkeeperClientAuthenticationPlugin().trim().length() > 0) {
        bkConf.setClientAuthProviderFactoryClass(conf.getBookkeeperClientAuthenticationPlugin());
        bkConf.setProperty(conf.getBookkeeperClientAuthenticationParametersName(),
                conf.getBookkeeperClientAuthenticationParameters());
    }

    bkConf.setThrottleValue(0);
    bkConf.setAddEntryTimeout((int) conf.getBookkeeperClientTimeoutInSeconds());
    bkConf.setReadEntryTimeout((int) conf.getBookkeeperClientTimeoutInSeconds());
    bkConf.setSpeculativeReadTimeout(conf.getBookkeeperClientSpeculativeReadTimeoutInMillis());
    bkConf.setNumChannelsPerBookie(16);
    bkConf.setUseV2WireProtocol(true);
    bkConf.setLedgerManagerFactoryClassName(HierarchicalLedgerManagerFactory.class.getName());
    if (conf.isBookkeeperClientHealthCheckEnabled()) {
        bkConf.enableBookieHealthCheck();
        bkConf.setBookieHealthCheckInterval(conf.getBookkeeperHealthCheckIntervalSec(), TimeUnit.SECONDS);
        bkConf.setBookieErrorThresholdPerInterval(conf.getBookkeeperClientHealthCheckErrorThresholdPerInterval());
        bkConf.setBookieQuarantineTime((int) conf.getBookkeeperClientHealthCheckQuarantineTimeInSeconds(),
                TimeUnit.SECONDS);
    }

    if (conf.isBookkeeperClientRackawarePolicyEnabled()) {
        bkConf.setEnsemblePlacementPolicy(RackawareEnsemblePlacementPolicy.class);
        bkConf.setProperty(RackawareEnsemblePlacementPolicy.REPP_DNS_RESOLVER_CLASS,
                ZkBookieRackAffinityMapping.class.getName());
        this.rackawarePolicyZkCache = new ZooKeeperCache(zkClient) {
        };
        bkConf.setProperty(ZooKeeperCache.ZK_CACHE_INSTANCE, this.rackawarePolicyZkCache);
    }

    if (conf.getBookkeeperClientIsolationGroups() != null && !conf.getBookkeeperClientIsolationGroups().isEmpty()) {
        bkConf.setEnsemblePlacementPolicy(ZkIsolatedBookieEnsemblePlacementPolicy.class);
        bkConf.setProperty(ZkIsolatedBookieEnsemblePlacementPolicy.ISOLATION_BOOKIE_GROUPS,
                conf.getBookkeeperClientIsolationGroups());
        if (bkConf.getProperty(ZooKeeperCache.ZK_CACHE_INSTANCE) == null) {
            this.clientIsolationZkCache = new ZooKeeperCache(zkClient) {
            };
            bkConf.setProperty(ZooKeeperCache.ZK_CACHE_INSTANCE, this.clientIsolationZkCache);
        }
    }

    try {
        return new BookKeeper(bkConf, zkClient);
    } catch (InterruptedException | KeeperException e) {
        throw new IOException(e);
    }
}
 
开发者ID:apache,项目名称:incubator-pulsar,代码行数:53,代码来源:BookKeeperClientFactoryImpl.java


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