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


Java Setting类代码示例

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


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

示例1: getSettings

import org.elasticsearch.common.settings.Setting; //导入依赖的package包/类
@Override
public List<Setting<?>> getSettings() {
    return Arrays.asList(
        Netty4HttpServerTransport.SETTING_HTTP_NETTY_MAX_CUMULATION_BUFFER_CAPACITY,
        Netty4HttpServerTransport.SETTING_HTTP_NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS,
        Netty4HttpServerTransport.SETTING_HTTP_WORKER_COUNT,
        Netty4HttpServerTransport.SETTING_HTTP_TCP_NO_DELAY,
        Netty4HttpServerTransport.SETTING_HTTP_TCP_KEEP_ALIVE,
        Netty4HttpServerTransport.SETTING_HTTP_TCP_REUSE_ADDRESS,
        Netty4HttpServerTransport.SETTING_HTTP_TCP_SEND_BUFFER_SIZE,
        Netty4HttpServerTransport.SETTING_HTTP_TCP_RECEIVE_BUFFER_SIZE,
        Netty4HttpServerTransport.SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_SIZE,
        Netty4HttpServerTransport.SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_MIN,
        Netty4HttpServerTransport.SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_MAX,
        Netty4Transport.WORKER_COUNT,
        Netty4Transport.NETTY_MAX_CUMULATION_BUFFER_CAPACITY,
        Netty4Transport.NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS,
        Netty4Transport.NETTY_RECEIVE_PREDICTOR_SIZE,
        Netty4Transport.NETTY_RECEIVE_PREDICTOR_MIN,
        Netty4Transport.NETTY_RECEIVE_PREDICTOR_MAX,
        Netty4Transport.NETTY_BOSS_COUNT
    );
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:24,代码来源:Netty4Plugin.java

示例2: buildRemoteClustersSeeds

import org.elasticsearch.common.settings.Setting; //导入依赖的package包/类
static Map<String, List<DiscoveryNode>> buildRemoteClustersSeeds(Settings settings) {
    Stream<Setting<List<InetSocketAddress>>> allConcreteSettings = REMOTE_CLUSTERS_SEEDS.getAllConcreteSettings(settings);
    return allConcreteSettings.collect(
        Collectors.toMap(REMOTE_CLUSTERS_SEEDS::getNamespace,  concreteSetting -> {
        String clusterName = REMOTE_CLUSTERS_SEEDS.getNamespace(concreteSetting);
        List<DiscoveryNode> nodes = new ArrayList<>();
        for (InetSocketAddress address : concreteSetting.get(settings)) {
            TransportAddress transportAddress = new TransportAddress(address);
            DiscoveryNode node = new DiscoveryNode(clusterName + "#" + transportAddress.toString(),
                transportAddress,
                Version.CURRENT.minimumCompatibilityVersion());
            nodes.add(node);
        }
        return nodes;
    }));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:RemoteClusterService.java

示例3: testListener

import org.elasticsearch.common.settings.Setting; //导入依赖的package包/类
public void testListener() throws IOException {
    Setting<Boolean> booleanSetting = Setting.boolSetting("index.foo.bar", false, Property.Dynamic, Property.IndexScope);
    IndexModule module = new IndexModule(IndexSettingsModule.newIndexSettings(index, settings, booleanSetting),
            new AnalysisRegistry(environment, emptyMap(), emptyMap(), emptyMap(), emptyMap(), emptyMap()));
    Setting<Boolean> booleanSetting2 = Setting.boolSetting("index.foo.bar.baz", false, Property.Dynamic, Property.IndexScope);
    AtomicBoolean atomicBoolean = new AtomicBoolean(false);
    module.addSettingsUpdateConsumer(booleanSetting, atomicBoolean::set);

    try {
        module.addSettingsUpdateConsumer(booleanSetting2, atomicBoolean::set);
        fail("not registered");
    } catch (IllegalArgumentException ex) {

    }

    IndexService indexService = newIndexService(module);
    assertSame(booleanSetting, indexService.getIndexSettings().getScopedSettings().get(booleanSetting.getKey()));

    indexService.close("simon says", false);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:21,代码来源:IndexModuleTests.java

示例4: testRunListener

import org.elasticsearch.common.settings.Setting; //导入依赖的package包/类
public void testRunListener() {
    Version version = VersionUtils.getPreviousVersion();
    Settings theSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version)
        .put(IndexMetaData.SETTING_INDEX_UUID, "0xdeadbeef").build();
    final AtomicInteger integer = new AtomicInteger(0);
    Setting<Integer> integerSetting = Setting.intSetting("index.test.setting.int", -1,
        Property.Dynamic, Property.IndexScope);
    IndexMetaData metaData = newIndexMeta("index", theSettings);
    IndexSettings settings = newIndexSettings(newIndexMeta("index", theSettings), Settings.EMPTY, integerSetting);
    settings.getScopedSettings().addSettingsUpdateConsumer(integerSetting, integer::set);

    assertEquals(version, settings.getIndexVersionCreated());
    assertEquals("0xdeadbeef", settings.getUUID());

    assertFalse(settings.updateIndexMetaData(metaData));
    assertEquals(metaData.getSettings().getAsMap(), settings.getSettings().getAsMap());
    assertEquals(0, integer.get());
    assertTrue(settings.updateIndexMetaData(newIndexMeta("index", Settings.builder().put(theSettings).put("index.test.setting.int", 42)
        .build())));
    assertEquals(42, integer.get());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:22,代码来源:IndexSettingsTests.java

示例5: testSettingsUpdateValidator

import org.elasticsearch.common.settings.Setting; //导入依赖的package包/类
public void testSettingsUpdateValidator() {
    Version version = VersionUtils.getPreviousVersion();
    Settings theSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version)
        .put(IndexMetaData.SETTING_INDEX_UUID, "0xdeadbeef").build();
    final AtomicInteger integer = new AtomicInteger(0);
    Setting<Integer> integerSetting = Setting.intSetting("index.test.setting.int", -1,
        Property.Dynamic, Property.IndexScope);
    IndexMetaData metaData = newIndexMeta("index", theSettings);
    IndexSettings settings = newIndexSettings(newIndexMeta("index", theSettings), Settings.EMPTY, integerSetting);
    settings.getScopedSettings().addSettingsUpdateConsumer(integerSetting, integer::set,
        (i) -> {if (i == 42) throw new AssertionError("boom");});

    assertEquals(version, settings.getIndexVersionCreated());
    assertEquals("0xdeadbeef", settings.getUUID());

    assertFalse(settings.updateIndexMetaData(metaData));
    assertEquals(metaData.getSettings().getAsMap(), settings.getSettings().getAsMap());
    assertEquals(0, integer.get());
    expectThrows(IllegalArgumentException.class, () -> settings.updateIndexMetaData(newIndexMeta("index",
        Settings.builder().put(theSettings).put("index.test.setting.int", 42).build())));
    assertTrue(settings.updateIndexMetaData(newIndexMeta("index", Settings.builder().put(theSettings).put("index.test.setting.int", 41)
        .build())));
    assertEquals(41, integer.get());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:25,代码来源:IndexSettingsTests.java

示例6: testAWSCredentialsWithElasticsearchAwsAndS3AndRepositoriesSettingsBackcompat

import org.elasticsearch.common.settings.Setting; //导入依赖的package包/类
public void testAWSCredentialsWithElasticsearchAwsAndS3AndRepositoriesSettingsBackcompat() {
    Settings settings = Settings.builder()
        .put(AwsS3Service.KEY_SETTING.getKey(), "aws_key")
        .put(AwsS3Service.SECRET_SETTING.getKey(), "aws_secret")
        .put(AwsS3Service.CLOUD_S3.KEY_SETTING.getKey(), "s3_key")
        .put(AwsS3Service.CLOUD_S3.SECRET_SETTING.getKey(), "s3_secret")
        .put(S3Repository.Repositories.KEY_SETTING.getKey(), "repositories_key")
        .put(S3Repository.Repositories.SECRET_SETTING.getKey(), "repositories_secret")
        .build();
    launchAWSCredentialsWithElasticsearchSettingsTest(Settings.EMPTY, settings, "repositories_key", "repositories_secret");
    assertSettingDeprecationsAndWarnings(new Setting<?>[]{
            AwsS3Service.KEY_SETTING,
            AwsS3Service.SECRET_SETTING,
            AwsS3Service.CLOUD_S3.KEY_SETTING,
            AwsS3Service.CLOUD_S3.SECRET_SETTING,
            S3Repository.Repositories.KEY_SETTING,
            S3Repository.Repositories.SECRET_SETTING});
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:19,代码来源:AwsS3ServiceImplTests.java

示例7: testAWSConfigurationWithAwsSettingsBackcompat

import org.elasticsearch.common.settings.Setting; //导入依赖的package包/类
public void testAWSConfigurationWithAwsSettingsBackcompat() {
    Settings settings = Settings.builder()
        .put(AwsS3Service.PROTOCOL_SETTING.getKey(), "http")
        .put(AwsS3Service.PROXY_HOST_SETTING.getKey(), "aws_proxy_host")
        .put(AwsS3Service.PROXY_PORT_SETTING.getKey(), 8080)
        .put(AwsS3Service.PROXY_USERNAME_SETTING.getKey(), "aws_proxy_username")
        .put(AwsS3Service.PROXY_PASSWORD_SETTING.getKey(), "aws_proxy_password")
        .put(AwsS3Service.SIGNER_SETTING.getKey(), "AWS3SignerType")
        .put(AwsS3Service.READ_TIMEOUT.getKey(), "10s")
        .build();
    launchAWSConfigurationTest(settings, Settings.EMPTY, Protocol.HTTP, "aws_proxy_host", 8080, "aws_proxy_username",
        "aws_proxy_password", "AWS3SignerType", 3, false, 10000);
     assertSettingDeprecationsAndWarnings(new Setting<?>[]{
            AwsS3Service.PROXY_USERNAME_SETTING,
            AwsS3Service.PROXY_PASSWORD_SETTING,
            AwsS3Service.PROTOCOL_SETTING,
            AwsS3Service.PROXY_HOST_SETTING,
            AwsS3Service.PROXY_PORT_SETTING,
            AwsS3Service.SIGNER_SETTING,
            AwsS3Service.READ_TIMEOUT});
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:22,代码来源:AwsS3ServiceImplTests.java

示例8: getSettings

import org.elasticsearch.common.settings.Setting; //导入依赖的package包/类
@Override
public List<Setting<?>> getSettings() {
    return Arrays.asList(SETTING_INXPROXY_DATA_PATH, //
            SETTING_INXPROXY_DATA_FILE_FORMAT, //
            SETTING_INXPROXY_DATA_FILE_SIZE, //
            SETTING_INXPROXY_SENDER_INTERVAL, //
            SETTING_INXPROXY_SENDER_RETRY_COUNT, //
            SETTING_INXPROXY_SENDER_REQUEST_RETRY_COUNT, //
            SETTING_INXPROXY_SENDER_SKIP_ERROR_FILE, //
            SETTING_INXPROXY_SENDER_LOOKUP_FILES, //
            SETTING_INXPROXY_MONITOR_INTERVAL, //
            SETTING_INXPROXY_WRITER_RETRY_COUNT, //
            SETTING_INXPROXY_SENDER_NODES, //
            SETTING_INXPROXY_WRITE_NODES, //
            SETTING_INXPROXY_FLUSH_PER_DOC, //
            SETTING_INXPROXY_NUMBER_OF_REPLICAS, //
            SETTING_INXPROXY_NUMBER_OF_SHARDS, //
            SETTING_INXPROXY_TARGET_INDICES, //
            SETTING_INXPROXY_RENEW_ACTIONS);
}
 
开发者ID:codelibs,项目名称:elasticsearch-indexing-proxy,代码行数:21,代码来源:IndexingProxyPlugin.java

示例9: testBadRequest

import org.elasticsearch.common.settings.Setting; //导入依赖的package包/类
public void testBadRequest() throws IOException {
    final Response response = client().performRequest("GET", "/_nodes/settings", Collections.emptyMap());
    final ObjectPath objectPath = ObjectPath.createFromResponse(response);
    final Map<String, Object> map = objectPath.evaluate("nodes");
    int maxMaxInitialLineLength = Integer.MIN_VALUE;
    final Setting<ByteSizeValue> httpMaxInitialLineLength = HttpTransportSettings.SETTING_HTTP_MAX_INITIAL_LINE_LENGTH;
    final String key = httpMaxInitialLineLength.getKey().substring("http.".length());
    for (Map.Entry<String, Object> entry : map.entrySet()) {
        @SuppressWarnings("unchecked") final Map<String, Object> settings =
                (Map<String, Object>)((Map<String, Object>)entry.getValue()).get("settings");
                final int maxIntialLineLength;
        if (settings.containsKey("http")) {
            @SuppressWarnings("unchecked") final Map<String, Object> httpSettings = (Map<String, Object>)settings.get("http");
            if (httpSettings.containsKey(key)) {
                maxIntialLineLength = ByteSizeValue.parseBytesSizeValue((String)httpSettings.get(key), key).bytesAsInt();
            } else {
                maxIntialLineLength = httpMaxInitialLineLength.getDefault(Settings.EMPTY).bytesAsInt();
            }
        } else {
            maxIntialLineLength = httpMaxInitialLineLength.getDefault(Settings.EMPTY).bytesAsInt();
        }
        maxMaxInitialLineLength = Math.max(maxMaxInitialLineLength, maxIntialLineLength);
    }

    final String path = "/" + new String(new byte[maxMaxInitialLineLength], Charset.forName("UTF-8")).replace('\0', 'a');
    final ResponseException e =
            expectThrows(
                    ResponseException.class,
                    () -> client().performRequest(randomFrom("GET", "POST", "PUT"), path, Collections.emptyMap()));
    assertThat(e.getResponse().getStatusLine().getStatusCode(), equalTo(BAD_REQUEST.getStatus()));
    assertThat(e, hasToString(containsString("too_long_frame_exception")));
    assertThat(e, hasToString(matches("An HTTP line is larger than \\d+ bytes")));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:34,代码来源:Netty4BadRequestIT.java

示例10: getSettings

import org.elasticsearch.common.settings.Setting; //导入依赖的package包/类
@Override
public List<Setting<?>> getSettings() {
    return Arrays.asList(
        URLRepository.ALLOWED_URLS_SETTING,
        URLRepository.REPOSITORIES_URL_SETTING,
        URLRepository.SUPPORTED_PROTOCOLS_SETTING
    );
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:URLRepositoryPlugin.java

示例11: getSettings

import org.elasticsearch.common.settings.Setting; //导入依赖的package包/类
@Override
public List<Setting<?>> getSettings() {
    return Arrays.asList(
        TestDeprecationHeaderRestAction.TEST_DEPRECATED_SETTING_TRUE1,
        TestDeprecationHeaderRestAction.TEST_DEPRECATED_SETTING_TRUE2,
        TestDeprecationHeaderRestAction.TEST_NOT_DEPRECATED_SETTING);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:8,代码来源:TestDeprecationPlugin.java

示例12: assertSettingDeprecationsAndWarnings

import org.elasticsearch.common.settings.Setting; //导入依赖的package包/类
/**
 * Convenience method to assert warnings for settings deprecations and general deprecation warnings.
 *
 * @param settings the settings that are expected to be deprecated
 * @param warnings other expected general deprecation warnings
 */
protected final void assertSettingDeprecationsAndWarnings(final Setting<?>[] settings, final String... warnings) {
    assertWarnings(
            Stream.concat(
                    Arrays
                            .stream(settings)
                            .map(Setting::getKey)
                            .map(k -> "[" + k + "] setting was deprecated in Elasticsearch and will be removed in a future release! " +
                                    "See the breaking changes documentation for the next major version."),
                    Arrays.stream(warnings))
                    .toArray(String[]::new));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:18,代码来源:ESTestCase.java

示例13: newIndexSettings

import org.elasticsearch.common.settings.Setting; //导入依赖的package包/类
public static IndexSettings newIndexSettings(Index index, Settings indexSetting, Settings nodeSettings, Setting<?>... setting) {
    Settings build = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
        .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1)
        .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1)
        .put(indexSetting)
        .build();
    IndexMetaData metaData = IndexMetaData.builder(index.getName()).settings(build).build();
    Set<Setting<?>> settingSet = new HashSet<>(IndexScopedSettings.BUILT_IN_INDEX_SETTINGS);
    if (setting.length > 0) {
        settingSet.addAll(Arrays.asList(setting));
    }
    return new IndexSettings(metaData, nodeSettings, new IndexScopedSettings(Settings.EMPTY, settingSet));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:14,代码来源:IndexSettingsModule.java

示例14: getSettings

import org.elasticsearch.common.settings.Setting; //导入依赖的package包/类
@Override
public List<Setting<?>> getSettings() {
    return Arrays.asList(INDEX_CHECK_INDEX_ON_CLOSE_SETTING,
    MockFSDirectoryService.CRASH_INDEX_SETTING,
    MockFSDirectoryService.RANDOM_IO_EXCEPTION_RATE_SETTING,
    MockFSDirectoryService.RANDOM_PREVENT_DOUBLE_WRITE_SETTING,
    MockFSDirectoryService.RANDOM_NO_DELETE_OPEN_FILE_SETTING,
    MockFSDirectoryService.RANDOM_IO_EXCEPTION_RATE_ON_OPEN_SETTING);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:MockFSIndexStore.java

示例15: ScriptSettings

import org.elasticsearch.common.settings.Setting; //导入依赖的package包/类
public ScriptSettings(ScriptEngineRegistry scriptEngineRegistry, ScriptContextRegistry scriptContextRegistry) {
    Map<ScriptContext, Setting<Boolean>> scriptContextSettingMap = contextSettings(scriptContextRegistry);
    this.scriptContextSettingMap = Collections.unmodifiableMap(scriptContextSettingMap);

    List<Setting<Boolean>> scriptLanguageSettings = languageSettings(SCRIPT_TYPE_SETTING_MAP, scriptContextSettingMap, scriptEngineRegistry, scriptContextRegistry);
    this.scriptLanguageSettings = Collections.unmodifiableList(scriptLanguageSettings);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:8,代码来源:ScriptSettings.java


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