當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。