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


Java ResourceWatcherService类代码示例

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


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

示例1: init

import org.elasticsearch.watcher.ResourceWatcherService; //导入依赖的package包/类
@BeforeClass
public static void init() throws IOException {
    Path genericConfigFolder = createTempDir();
    Settings baseSettings = Settings.builder()
            .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString())
            .put(Environment.PATH_CONF_SETTING.getKey(), genericConfigFolder)
            .build();
    Environment environment = new Environment(baseSettings);
    ScriptContextRegistry scriptContextRegistry = new ScriptContextRegistry(Collections.emptyList());
    ScriptEngineRegistry scriptEngineRegistry = new ScriptEngineRegistry(Collections.singletonList(new TestEngineService()));
    ScriptSettings scriptSettings = new ScriptSettings(scriptEngineRegistry, scriptContextRegistry);
    scriptService = new ScriptService(baseSettings, environment,
            new ResourceWatcherService(baseSettings, null), scriptEngineRegistry, scriptContextRegistry, scriptSettings) {
        @Override
        public CompiledScript compile(Script script, ScriptContext scriptContext) {
            return new CompiledScript(ScriptType.INLINE, "mockName", "test", script);
        }
    };

    SearchModule searchModule = new SearchModule(Settings.EMPTY, false, emptyList());
    namedWriteableRegistry = new NamedWriteableRegistry(searchModule.getNamedWriteables());
    xContentRegistry = new NamedXContentRegistry(searchModule.getNamedXContents());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:24,代码来源:AbstractSortTestCase.java

示例2: setUp

import org.elasticsearch.watcher.ResourceWatcherService; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
    super.setUp();
    settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
            .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()).build();
    indicesQueryCache = new IndicesQueryCache(settings);
    indexSettings = IndexSettingsModule.newIndexSettings("foo", settings);
    index = indexSettings.getIndex();
    environment = new Environment(settings);
    threadPool = new TestThreadPool("test");
    circuitBreakerService = new NoneCircuitBreakerService();
    bigArrays = new BigArrays(settings, circuitBreakerService);
    ScriptEngineRegistry scriptEngineRegistry = new ScriptEngineRegistry(emptyList());
    ScriptContextRegistry scriptContextRegistry = new ScriptContextRegistry(Collections.emptyList());
    ScriptSettings scriptSettings = new ScriptSettings(scriptEngineRegistry, scriptContextRegistry);
    scriptService = new ScriptService(settings, environment, new ResourceWatcherService(settings, threadPool), scriptEngineRegistry,
            scriptContextRegistry, scriptSettings);
    clusterService = ClusterServiceUtils.createClusterService(threadPool);
    nodeEnvironment = new NodeEnvironment(settings, environment);
    mapperRegistry = new IndicesModule(Collections.emptyList()).getMapperRegistry();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:22,代码来源:IndexModuleTests.java

示例3: createComponents

import org.elasticsearch.watcher.ResourceWatcherService; //导入依赖的package包/类
@Override
public Collection<Object> createComponents(
        Client client,
        ClusterService clusterService,
        ThreadPool threadPool,
        ResourceWatcherService resourceWatcherService,
        ScriptService scriptService,
        NamedXContentRegistry xContentRegistry) {
    final int concurrentConnects = UnicastZenPing.DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING.get(settings);
    final ThreadFactory threadFactory = EsExecutors.daemonThreadFactory(settings, "[file_based_discovery_resolve]");
    fileBasedDiscoveryExecutorService = EsExecutors.newScaling(
        "file_based_discovery_resolve",
        0,
        concurrentConnects,
        60,
        TimeUnit.SECONDS,
        threadFactory,
        threadPool.getThreadContext());

    return Collections.emptyList();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:22,代码来源:FileBasedDiscoveryPlugin.java

示例4: create

import org.elasticsearch.watcher.ResourceWatcherService; //导入依赖的package包/类
/**
 * Build from {@linkplain ScriptPlugin}s. Convenient for normal use but not great for tests. See
 * {@link ScriptModule#ScriptModule(Settings, Environment, ResourceWatcherService, List, List)} for easier use in tests.
 */
public static ScriptModule create(Settings settings, Environment environment,
                                  ResourceWatcherService resourceWatcherService, List<ScriptPlugin> scriptPlugins) {
    Map<String, NativeScriptFactory> factoryMap = scriptPlugins.stream().flatMap(x -> x.getNativeScripts().stream())
        .collect(Collectors.toMap(NativeScriptFactory::getName, Function.identity()));
    NativeScriptEngineService nativeScriptEngineService = new NativeScriptEngineService(settings, factoryMap);
    List<ScriptEngineService> scriptEngineServices = scriptPlugins.stream().map(x -> x.getScriptEngineService(settings))
        .filter(Objects::nonNull).collect(Collectors.toList());
    scriptEngineServices.add(nativeScriptEngineService);
    List<ScriptContext.Plugin> plugins = scriptPlugins.stream().map(x -> x.getCustomScriptContexts()).filter(Objects::nonNull)
            .collect(Collectors.toList());
    return new ScriptModule(settings, environment, resourceWatcherService, scriptEngineServices, plugins);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:ScriptModule.java

示例5: ScriptModule

import org.elasticsearch.watcher.ResourceWatcherService; //导入依赖的package包/类
/**
 * Build {@linkplain ScriptEngineService} and {@linkplain ScriptContext.Plugin}.
 */
public ScriptModule(Settings settings, Environment environment,
                    ResourceWatcherService resourceWatcherService, List<ScriptEngineService> scriptEngineServices,
                    List<ScriptContext.Plugin> customScriptContexts) {
    ScriptContextRegistry scriptContextRegistry = new ScriptContextRegistry(customScriptContexts);
    ScriptEngineRegistry scriptEngineRegistry = new ScriptEngineRegistry(scriptEngineServices);
    scriptSettings = new ScriptSettings(scriptEngineRegistry, scriptContextRegistry);
    try {
        scriptService = new ScriptService(settings, environment, resourceWatcherService, scriptEngineRegistry, scriptContextRegistry,
                scriptSettings);
    } catch (IOException e) {
        throw new RuntimeException("Couldn't setup ScriptService", e);
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:ScriptModule.java

示例6: stop

import org.elasticsearch.watcher.ResourceWatcherService; //导入依赖的package包/类
private Node stop() {
    if (!lifecycle.moveToStopped()) {
        return this;
    }
    Logger logger = Loggers.getLogger(Node.class, NODE_NAME_SETTING.get(settings));
    logger.info("stopping ...");

    injector.getInstance(TribeService.class).stop();
    injector.getInstance(ResourceWatcherService.class).stop();
    if (NetworkModule.HTTP_ENABLED.get(settings)) {
        injector.getInstance(HttpServerTransport.class).stop();
    }

    injector.getInstance(SnapshotsService.class).stop();
    injector.getInstance(SnapshotShardsService.class).stop();
    // stop any changes happening as a result of cluster state changes
    injector.getInstance(IndicesClusterStateService.class).stop();
    // close discovery early to not react to pings anymore.
    // This can confuse other nodes and delay things - mostly if we're the master and we're running tests.
    injector.getInstance(Discovery.class).stop();
    // we close indices first, so operations won't be allowed on it
    injector.getInstance(RoutingService.class).stop();
    injector.getInstance(ClusterService.class).stop();
    injector.getInstance(NodeConnectionsService.class).stop();
    injector.getInstance(MonitorService.class).stop();
    injector.getInstance(GatewayService.class).stop();
    injector.getInstance(SearchService.class).stop();
    injector.getInstance(TransportService.class).stop();
    injector.getInstance(SearchTransportService.class).stop();

    pluginLifecycleComponents.forEach(LifecycleComponent::stop);
    // we should stop this last since it waits for resources to get released
    // if we had scroll searchers etc or recovery going on we wait for to finish.
    injector.getInstance(IndicesService.class).stop();
    logger.info("stopped");

    return this;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:39,代码来源:Node.java

示例7: setup

import org.elasticsearch.watcher.ResourceWatcherService; //导入依赖的package包/类
@Before
public void setup() throws IOException {
    Path genericConfigFolder = createTempDir();
    baseSettings = Settings.builder()
            .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString())
            .put(Environment.PATH_CONF_SETTING.getKey(), genericConfigFolder)
            .put(ScriptService.SCRIPT_MAX_COMPILATIONS_PER_MINUTE.getKey(), 10000)
            .build();
    resourceWatcherService = new ResourceWatcherService(baseSettings, null);
    scriptEngineService = new TestEngineService();
    dangerousScriptEngineService = new TestDangerousEngineService();
    TestEngineService defaultScriptServiceEngine = new TestEngineService(Script.DEFAULT_SCRIPT_LANG) {};
    scriptEnginesByLangMap = ScriptModesTests.buildScriptEnginesByLangMap(
            new HashSet<>(Arrays.asList(scriptEngineService, defaultScriptServiceEngine)));
    //randomly register custom script contexts
    int randomInt = randomIntBetween(0, 3);
    //prevent duplicates using map
    Map<String, ScriptContext.Plugin> contexts = new HashMap<>();
    for (int i = 0; i < randomInt; i++) {
        String plugin;
        do {
            plugin = randomAsciiOfLength(randomIntBetween(1, 10));
        } while (ScriptContextRegistry.RESERVED_SCRIPT_CONTEXTS.contains(plugin));
        String operation;
        do {
            operation = randomAsciiOfLength(randomIntBetween(1, 30));
        } while (ScriptContextRegistry.RESERVED_SCRIPT_CONTEXTS.contains(operation));
        String context = plugin + "_" + operation;
        contexts.put(context, new ScriptContext.Plugin(plugin, operation));
    }
    scriptEngineRegistry = new ScriptEngineRegistry(Arrays.asList(scriptEngineService, dangerousScriptEngineService,
            defaultScriptServiceEngine));
    scriptContextRegistry = new ScriptContextRegistry(contexts.values());
    scriptSettings = new ScriptSettings(scriptEngineRegistry, scriptContextRegistry);
    scriptContexts = scriptContextRegistry.scriptContexts().toArray(new ScriptContext[scriptContextRegistry.scriptContexts().size()]);
    logger.info("--> setup script service");
    scriptsFilePath = genericConfigFolder.resolve("scripts");
    Files.createDirectories(scriptsFilePath);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:40,代码来源:ScriptServiceTests.java

示例8: createComponents

import org.elasticsearch.watcher.ResourceWatcherService; //导入依赖的package包/类
@Override
public Collection<Object> createComponents(final Client client, final ClusterService clusterService, final ThreadPool threadPool,
        final ResourceWatcherService resourceWatcherService, final ScriptService scriptService,
        final NamedXContentRegistry xContentRegistry) {
    final Collection<Object> components = new ArrayList<>();
    components.add(pluginComponent);
    return components;
}
 
开发者ID:codelibs,项目名称:elasticsearch-indexing-proxy,代码行数:9,代码来源:IndexingProxyPlugin.java

示例9: stop

import org.elasticsearch.watcher.ResourceWatcherService; //导入依赖的package包/类
private Node stop() {
    if (!lifecycle.moveToStopped()) {
        return this;
    }
    ESLogger logger = Loggers.getLogger(Node.class, settings.get("name"));
    logger.info("stopping ...");

    injector.getInstance(TribeService.class).stop();
    injector.getInstance(ResourceWatcherService.class).stop();
    if (settings.getAsBoolean("http.enabled", true)) {
        injector.getInstance(HttpServer.class).stop();
    }

    injector.getInstance(SnapshotsService.class).stop();
    injector.getInstance(SnapshotShardsService.class).stop();
    // stop any changes happening as a result of cluster state changes
    injector.getInstance(IndicesClusterStateService.class).stop();
    // we close indices first, so operations won't be allowed on it
    injector.getInstance(IndexingMemoryController.class).stop();
    injector.getInstance(IndicesTTLService.class).stop();
    injector.getInstance(RoutingService.class).stop();
    injector.getInstance(ClusterService.class).stop();
    injector.getInstance(DiscoveryService.class).stop();
    injector.getInstance(MonitorService.class).stop();
    injector.getInstance(GatewayService.class).stop();
    injector.getInstance(SearchService.class).stop();
    injector.getInstance(RestController.class).stop();
    injector.getInstance(TransportService.class).stop();

    for (Class<? extends LifecycleComponent> plugin : pluginsService.nodeServices()) {
        injector.getInstance(plugin).stop();
    }
    // we should stop this last since it waits for resources to get released
    // if we had scroll searchers etc or recovery going on we wait for to finish.
    injector.getInstance(IndicesService.class).stop();
    logger.info("stopped");

    return this;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:40,代码来源:Node.java

示例10: createComponents

import org.elasticsearch.watcher.ResourceWatcherService; //导入依赖的package包/类
@Override
public Collection<Object> createComponents(Client client, ClusterService clusterService, ThreadPool threadPool,
                                           ResourceWatcherService resourceWatcherService, ScriptService scriptService,
                                           NamedXContentRegistry xContentRegistry) {
    clusterService.addListener(event -> {
        for (Index i : event.indicesDeleted()) {
            if (IndexFeatureStore.isIndexStore(i.getName())) {
                caches.evict(i.getName());
            }
        }
    });
    return asList(caches, parserFactory);
}
 
开发者ID:o19s,项目名称:elasticsearch-learning-to-rank,代码行数:14,代码来源:LtrQueryParserPlugin.java

示例11: createComponents

import org.elasticsearch.watcher.ResourceWatcherService; //导入依赖的package包/类
@Override
public Collection<Object> createComponents(Client client,
                                           ClusterService clusterService,
                                           ThreadPool threadPool,
                                           ResourceWatcherService resourceWatcherService,
                                           ScriptService scriptService,
                                           NamedXContentRegistry xContentRegistry) {
    Collection<Object> components = new ArrayList<>();
    components.add(pluginComponent);
    return components;
}
 
开发者ID:hailin0,项目名称:elasticsearch-analysis-dynamic-synonym,代码行数:12,代码来源:DynamicSynonymPlugin.java

示例12: createComponents

import org.elasticsearch.watcher.ResourceWatcherService; //导入依赖的package包/类
@Override
public Collection<Object> createComponents(Client client, ClusterService clusterService, ThreadPool threadPool,
        ResourceWatcherService resourceWatcherService, ScriptService scriptService, NamedXContentRegistry xContentRegistry,
        Environment environment, NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry) {
    final Collection<Object> components = new ArrayList<>();
    components.add(pluginComponent);
    return components;
}
 
开发者ID:codelibs,项目名称:elasticsearch-analysis-fess,代码行数:9,代码来源:FessAnalysisPlugin.java

示例13: createComponents

import org.elasticsearch.watcher.ResourceWatcherService; //导入依赖的package包/类
@Override
public Collection<Object> createComponents(Client client, ClusterService clusterService, ThreadPool threadPool,
                                           ResourceWatcherService resourceWatcherService, ScriptService scriptService,
                                           SearchRequestParsers searchRequestParsers) {
    ModelTrainers modelTrainers = new ModelTrainers(Arrays.asList(new NaiveBayesModelTrainer()));
    TrainingService trainingService = new TrainingService(settings, clusterService, client, modelTrainers, searchRequestParsers);

    final ClusterSettings clusterSettings = clusterService.getClusterSettings();
    Setting<Settings> ingestAnalysisGroupSetting = ingestAnalysisService.getIngestAnalysisGroupSetting();
    clusterSettings.addSettingsUpdateConsumer(ingestAnalysisGroupSetting, ingestAnalysisService::setAnalysisSettings);
    ingestAnalysisService.setAnalysisSettings(ingestAnalysisGroupSetting.get(settings));

    return Arrays.asList(trainingService, ingestAnalysisService);
}
 
开发者ID:brwe,项目名称:es-token-plugin,代码行数:15,代码来源:TokenPlugin.java

示例14: createComponents

import org.elasticsearch.watcher.ResourceWatcherService; //导入依赖的package包/类
@Override
public Collection<Object> createComponents(Client localClient, ClusterService clusterService, ThreadPool threadPool,
        ResourceWatcherService resourceWatcherService, ScriptService scriptService, NamedXContentRegistry xContentRegistry,
        Environment environment, NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry) {

    final List<Object> components = new ArrayList<>(1);
    
    if(client) {
        return components;
    }
    
    final String principalExtractorClass = settings.get(SSLConfigConstants.SEARCHGUARD_SSL_TRANSPORT_PRINCIPAL_EXTRACTOR_CLASS, null);

    if(principalExtractorClass == null) {
        principalExtractor = new com.floragunn.searchguard.ssl.transport.DefaultPrincipalExtractor();
    } else {
        try {
            log.debug("Try to load and instantiate '{}'", principalExtractorClass);
            Class<?> principalExtractorClazz = Class.forName(principalExtractorClass);
            principalExtractor = (PrincipalExtractor) principalExtractorClazz.newInstance();
        } catch (Exception e) {
            log.error("Unable to load '{}' due to", principalExtractorClass, e);
            throw new ElasticsearchException(e);
        }
    }
    
    components.add(principalExtractor);
    
    return components;
}
 
开发者ID:floragunncom,项目名称:search-guard-ssl,代码行数:31,代码来源:SearchGuardSSLPlugin.java

示例15: createComponents

import org.elasticsearch.watcher.ResourceWatcherService; //导入依赖的package包/类
@Override
public Collection<Object> createComponents(Client client, ClusterService clusterService, ThreadPool threadPool,
        ResourceWatcherService resourceWatcherService, ScriptService scriptService,
        NamedXContentRegistry xContentRegistry, Environment environment,
        NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry) {
    final Collection<Object> components = new ArrayList<>();
    components.add(pluginComponent);
    return components;
}
 
开发者ID:codelibs,项目名称:elasticsearch-analysis-synonym,代码行数:10,代码来源:SynonymPlugin.java


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