本文整理汇总了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))))))));
}
示例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());
}
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}
示例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));
}
示例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"));
}
示例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;
}
示例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);
}
示例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);
}
示例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()));
}
示例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);
}
示例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());
}
示例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));
}