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


Java Configuration类代码示例

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


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

示例1: getDefaultRequestGenerator

import edu.uw.zookeeper.common.Configuration; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected Generator<? extends Records.Request> getDefaultRequestGenerator() {
    final Configuration configuration = getRuntimeModule().getConfiguration();
    final Float getPercentage = GetPercentageConfiguration.get(configuration);
    final Float dataMaxMB = DataMaxMBConfiguration.get(configuration);
    final ImmutableList.Builder<ZNodePath> paths = ImmutableList.builder();
    paths.add(ZNodePath.root());
    paths.addAll(PerfectTreePaths.forParameters(parameters));
    return PathRequestGenerator.create(
            RandomFromList.create(getRandom(), paths.build()),
            Generators.dereferencing(
                    BinGenerator.create(
                        getRandom(), 
                            Pair.create(
                                    getPercentage, 
                                    Generators.constant(Operations.Requests.getData())), 
                            Pair.create(
                                    Float.valueOf(1.0f - getPercentage.floatValue()), 
                                    SetDataGenerator.forData(RandomData.create(getRandom(), 0, (int) (dataMaxMB.floatValue() * Math.pow(2, 20))))))));
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-clients,代码行数:22,代码来源:GetSetClientBuilder.java

示例2: getDefaultTraceHeader

import edu.uw.zookeeper.common.Configuration; //导入依赖的package包/类
@Override
protected TraceHeader getDefaultTraceHeader() {
    Configuration configuration = getRuntimeModule().getConfiguration();
    ImmutableSet.Builder<TraceEventTag> types = ImmutableSet.builder();
    types.add(TraceEventTag.TIMESTAMP_EVENT);
    if (MeasureLatencyConfiguration.get(configuration)) {
        types.add(TraceEventTag.LATENCY_MEASUREMENT_EVENT);
    }
    if (MeasureThroughputConfiguration.get(configuration)) {
        types.add(TraceEventTag.THROUGHPUT_MEASUREMENT_EVENT);
    }
    if (types.build().size() == 1) {
        types.add(TraceEventTag.OPERATION_EVENT);
    }
    return TraceHeader.create(
            Tracing.getTraceDescription(getRuntimeModule().getConfiguration()), 
            types.build());
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-clients,代码行数:19,代码来源:MeasuringClientBuilder.java

示例3: apply

import edu.uw.zookeeper.common.Configuration; //导入依赖的package包/类
@Override
public File apply(Configuration configuration) {
    Configurable configurable = getClass().getAnnotation(Configurable.class);
    String value =
            configuration.withConfigurable(configurable)
                .getConfigOrEmpty(configurable.path())
                    .getString(configurable.key());
    if (new File(value).isDirectory()) {
        StringBuilder str = new StringBuilder(value);
        if (str.charAt(str.length() - 1) != File.separatorChar) {
            str.append(File.separatorChar);
        }
        value = str.append(getClass().getAnnotation(Configurable.class).value()).toString();
    }
    if (value.indexOf('%') != -1) {
        value = String.format(value, System.currentTimeMillis());
    }
    File file = new File(value).getAbsoluteFile();
    return file;
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-clients,代码行数:21,代码来源:Tracing.java

示例4: fromConfiguration

import edu.uw.zookeeper.common.Configuration; //导入依赖的package包/类
public static DefaultSessionParametersPolicy fromConfiguration(short id, Configuration configuration) {
    TimeValue minTimeout = ConfigurableMinTimeout.get(configuration);
    TimeValue maxTimeout = ConfigurableMaxTimeout.get(configuration);
    if (maxTimeout.value() != Session.Parameters.noTimeout()) {
        checkArgument(minTimeout.value() <= maxTimeout.value());
    }
    return defaults(id, minTimeout, maxTimeout);
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:9,代码来源:DefaultSessionParametersPolicy.java

示例5: get

import edu.uw.zookeeper.common.Configuration; //导入依赖的package包/类
public static ServerInetAddressView get(Configuration configuration) {
    Configurable configurable = getConfigurable();
    String value = 
            configuration.withConfigurable(configurable)
            .getConfigOrEmpty(configurable.path())
                .getString(configurable.arg());
    try {
        return ServerInetAddressView.fromString(value);
    } catch (UnknownHostException e) {
        throw new IllegalArgumentException(value, e);
    }
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:13,代码来源:ClientAddressConfiguration.java

示例6: fromConfiguration

import edu.uw.zookeeper.common.Configuration; //导入依赖的package包/类
public static <T extends SessionExecutor> SimpleSessionManager<T> fromConfiguration(
        short id,
        ConcurrentMap<Long, T> sessions,
        ParameterizedFactory<? super Session, ? extends T> factory,
        Configuration configuration) {
    DefaultSessionParametersPolicy policy = DefaultSessionParametersPolicy.fromConfiguration(id, configuration);
    return create(factory, sessions, policy);
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:9,代码来源:SimpleSessionManager.java

示例7: fromConfiguration

import edu.uw.zookeeper.common.Configuration; //导入依赖的package包/类
public static DefaultRuntimeModule fromConfiguration(Configuration configuration) {
    return create(
            configuration,
            ServiceMonitor.defaults(), 
            ListeningExecutorServiceFactory.newInstance(
                    DefaultApplicationExecutorFactory.fromConfiguration(configuration), 
                    SingleThreadScheduledExectorFactory.defaults()),
            ShutdownTimeoutConfiguration.get(configuration));
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:10,代码来源:DefaultRuntimeModule.java

示例8: fromThreadFactory

import edu.uw.zookeeper.common.Configuration; //导入依赖的package包/类
public static DefaultApplicationExecutorFactory fromThreadFactory(
        Configuration configuration, ThreadFactory threadFactory) {
    int corePoolSize = getCorePoolSize(configuration, DefaultApplicationExecutorFactory.class);
    int maxPoolSize = corePoolSize;
    return new DefaultApplicationExecutorFactory(
            corePoolSize,
            maxPoolSize,
            TimeValue.seconds(60),
            new ThreadFactoryBuilder().setThreadFactory(threadFactory).setNameFormat("main-pool-%d"));
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:11,代码来源:DefaultRuntimeModule.java

示例9: getCorePoolSize

import edu.uw.zookeeper.common.Configuration; //导入依赖的package包/类
protected static int getCorePoolSize(
        Configuration configuration,
        Class<?> cls) {
    Configurable configurable = cls.getAnnotation(Configurable.class);
    Config config = configuration.withConfigurable(configurable)
            .getConfigOrEmpty(configurable.path());
    int corePoolSize = config.getInt(configurable.key());
    if (corePoolSize == 0) {
        corePoolSize = availableProcessors();
    }
    return corePoolSize;
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:13,代码来源:DefaultRuntimeModule.java

示例10: create

import edu.uw.zookeeper.common.Configuration; //导入依赖的package包/类
public static DefaultRuntimeModule create(
        Configuration configuration,
        ServiceMonitor serviceMonitor,
        ListeningExecutorServiceFactory executors,
        TimeValue shutdownTimeout) {
    return new DefaultRuntimeModule(configuration, serviceMonitor, executors, shutdownTimeout);
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:8,代码来源:DefaultRuntimeModule.java

示例11: DefaultRuntimeModule

import edu.uw.zookeeper.common.Configuration; //导入依赖的package包/类
protected DefaultRuntimeModule(
        Configuration configuration,
        ServiceMonitor serviceMonitor,
        ListeningExecutorServiceFactory executors,
        TimeValue shutdownTimeout) {
    this.configuration = configuration;
    this.serviceMonitor = serviceMonitor;
    this.executors = executors;
    this.shutdownTimeout = shutdownTimeout;
    serviceMonitor.add(executors);
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:12,代码来源:DefaultRuntimeModule.java

示例12: apply

import edu.uw.zookeeper.common.Configuration; //导入依赖的package包/类
@Override
public TimeValue apply(Configuration configuration) {
    Configurable configurable = getClass().getAnnotation(Configurable.class);
    return TimeValue.fromString(
            configuration.withConfigurable(configurable)
                .getConfigOrEmpty(configurable.path())
                    .getString(configurable.arg()));
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:9,代码来源:ConfigurableTimeout.java

示例13: get

import edu.uw.zookeeper.common.Configuration; //导入依赖的package包/类
public static EnsembleView<ServerInetAddressView> get(Configuration configuration) {
    Configurable configurable = getConfigurable();
    String value = 
            configuration.withConfigurable(configurable)
            .getConfigOrEmpty(configurable.path())
                .getString(configurable.arg());
    return ServerInetAddressView.ensembleFromString(value);
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:9,代码来源:EnsembleViewConfiguration.java

示例14: apply

import edu.uw.zookeeper.common.Configuration; //导入依赖的package包/类
@Override
public Integer apply(Configuration configuration) {
    Configurable configurable = getClass().getAnnotation(Configurable.class);
    return configuration.withConfigurable(configurable)
                .getConfigOrEmpty(configurable.path())
                    .getInt(configurable.arg());
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:8,代码来源:LimitOutstandingClient.java

示例15: fromConfiguration

import edu.uw.zookeeper.common.Configuration; //导入依赖的package包/类
public static <V> CountingGenerator<V> fromConfiguration(
        Configuration configuration,
        Generator<? extends V> callable) {
    int limit = ConfigurableIterations.get(configuration);
    int logIterations = ConfigurableLogIterations.get(configuration);
    int logInterval;
    if (logIterations > 0) {
        logInterval = limit / logIterations;
    } else {
        logInterval = 0;
    }
    return create(limit, logInterval, callable, LogManager.getLogger(CountingGenerator.class));
}
 
开发者ID:lisaglendenning,项目名称:zookeeper-lite,代码行数:14,代码来源:CountingGenerator.java


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