Java Code Examples for org.elasticsearch.threadpool.ThreadPool#getThreadContext()

The following examples show how to use org.elasticsearch.threadpool.ThreadPool#getThreadContext() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OpenDistroSecuritySSLPlugin.java    From deprecated-security-ssl with Apache License 2.0 6 votes vote down vote up
@Override
public Map<String, Supplier<HttpServerTransport>> getHttpTransports(Settings settings, ThreadPool threadPool, BigArrays bigArrays,
        CircuitBreakerService circuitBreakerService, NamedWriteableRegistry namedWriteableRegistry,
        NamedXContentRegistry xContentRegistry, NetworkService networkService, Dispatcher dispatcher) {
    
    final Map<String, Supplier<HttpServerTransport>> httpTransports = new HashMap<String, Supplier<HttpServerTransport>>(1);
    if (!client && httpSSLEnabled) {
        
        final ValidatingDispatcher validatingDispatcher = new ValidatingDispatcher(threadPool.getThreadContext(), dispatcher, settings, configPath, NOOP_SSL_EXCEPTION_HANDLER);
        final OpenDistroSecuritySSLNettyHttpServerTransport sgsnht = new OpenDistroSecuritySSLNettyHttpServerTransport(settings, networkService, bigArrays, threadPool, odsks, xContentRegistry, validatingDispatcher, NOOP_SSL_EXCEPTION_HANDLER);
        
        httpTransports.put("com.amazon.opendistroforelasticsearch.security.ssl.http.netty.OpenDistroSecuritySSLNettyHttpServerTransport", () -> sgsnht);
        
    }
    return httpTransports;
}
 
Example 2
Source File: OpenDistroSecuritySSLNettyHttpServerTransport.java    From deprecated-security-ssl with Apache License 2.0 5 votes vote down vote up
public OpenDistroSecuritySSLNettyHttpServerTransport(final Settings settings, final NetworkService networkService, final BigArrays bigArrays,
        final ThreadPool threadPool, final OpenDistroSecurityKeyStore odks, final NamedXContentRegistry namedXContentRegistry, final ValidatingDispatcher dispatcher,
        final SslExceptionHandler errorHandler) {
    super(settings, networkService, bigArrays, threadPool, namedXContentRegistry, dispatcher);
    this.odks = odks;
    this.threadContext = threadPool.getThreadContext();
    this.errorHandler = errorHandler;
}
 
Example 3
Source File: OpenShiftElasticSearchPlugin.java    From openshift-elasticsearch-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Object> createComponents(Client client, ClusterService clusterService, ThreadPool threadPool,
        ResourceWatcherService resourceWatcherService, ScriptService scriptService,
        NamedXContentRegistry namedXContentRegistry) {

    final PluginSettings pluginSettings = new PluginSettings(settings);
    final IndexMappingLoader indexMappingLoader = new IndexMappingLoader(settings);
    final PluginClient pluginClient = new PluginClient(client, threadPool.getThreadContext());
    final OpenshiftAPIService apiService = new OpenshiftAPIService();
    final RequestUtils requestUtils = new RequestUtils(pluginSettings, apiService);
    final OpenshiftRequestContextFactory contextFactory = new OpenshiftRequestContextFactory(settings, requestUtils,
            apiService, threadPool.getThreadContext());
    final SearchGuardSyncStrategyFactory documentFactory = new SearchGuardSyncStrategyFactory(pluginSettings);
    final KibanaUtils kUtils = new KibanaUtils(pluginSettings, pluginClient);
    final KibanaSeed seed = new KibanaSeed(pluginSettings, indexMappingLoader, pluginClient, kUtils);
    final ACLDocumentManager aclDocumentManager = new ACLDocumentManager(pluginClient, pluginSettings, documentFactory, threadPool);
    this.aclFilter = new DynamicACLFilter(pluginSettings, seed, client, threadPool, requestUtils, aclDocumentManager);
    
    PluginServiceFactory.setApiService(apiService);
    PluginServiceFactory.setContextFactory(contextFactory);
    PluginServiceFactory.setThreadContext(threadPool.getThreadContext());
    PluginServiceFactory.markReady();

    List<Object> list = new ArrayList<>();
    list.add(aclDocumentManager);
    list.add(pluginSettings);
    list.add(indexMappingLoader);
    list.add(pluginClient);
    list.add(requestUtils);
    list.add(apiService);
    list.add(contextFactory);
    list.add(documentFactory);
    list.add(kUtils);
    list.add(seed);
    list.add(aclFilter);
    list.add(new FieldStatsResponseFilter(pluginClient));
    list.addAll(sgPlugin.createComponents(client, clusterService, threadPool, resourceWatcherService, scriptService,
            namedXContentRegistry));
    return list;
}
 
Example 4
Source File: ACLDocumentManager.java    From openshift-elasticsearch-plugin with Apache License 2.0 5 votes vote down vote up
public ACLDocumentManager(final PluginClient client, final PluginSettings settings, final SearchGuardSyncStrategyFactory documentFactory, ThreadPool threadPool) {
    this.searchGuardIndex = settings.getSearchGuardIndex();
    this.client = client;
    this.documentFactory = documentFactory;
    this.threadContext = threadPool.getThreadContext();
    this.configLoader = new ConfigurationLoader(client.getClient(), threadPool, settings.getSettings());
}
 
Example 5
Source File: ConfigurationLoader.java    From openshift-elasticsearch-plugin with Apache License 2.0 5 votes vote down vote up
public ConfigurationLoader(final Client client, ThreadPool threadPool, final Settings settings) {
    super();
    this.client = client;
    this.threadContext = threadPool.getThreadContext();
    this.searchguardIndex = settings.get(ConfigConstants.SG_CONFIG_INDEX, ConfigConstants.SG_DEFAULT_CONFIG_INDEX);
    log.debug("Index is: {}", searchguardIndex);
}
 
Example 6
Source File: DynamicACLFilter.java    From openshift-elasticsearch-plugin with Apache License 2.0 5 votes vote down vote up
public DynamicACLFilter(final PluginSettings settings, 
        final KibanaSeed seed, 
        final Client client, 
        final ThreadPool threadPool,
        final RequestUtils utils,
        final ACLDocumentManager aclManager) {
    this.threadContext = threadPool.getThreadContext();
    this.kibanaSeed = seed;
    this.kibanaVersion = settings.getKibanaVersion();
    this.kbnVersionHeader = settings.getKbnVersionHeader();
    this.cdmProjectPrefix = settings.getCdmProjectPrefix();
    this.defaultKibanaIndex = settings.getDefaultKibanaIndex();
    this.utils = utils;
    this.aclManager = aclManager;
}
 
Example 7
Source File: RangerElasticsearchPlugin.java    From ranger with Apache License 2.0 5 votes vote down vote up
@Override
public Collection<Object> createComponents(final Client client, final ClusterService clusterService,
		final ThreadPool threadPool, final ResourceWatcherService resourceWatcherService,
		final ScriptService scriptService, final NamedXContentRegistry xContentRegistry,
		final Environment environment, final NodeEnvironment nodeEnvironment,
		final NamedWriteableRegistry namedWriteableRegistry) {

	addPluginConfig2Classpath(environment);

	rangerSecurityActionFilter = new RangerSecurityActionFilter(threadPool.getThreadContext());
	return Collections.singletonList(rangerSecurityActionFilter);
}