本文整理汇总了Java中org.elasticsearch.common.component.LifecycleComponent类的典型用法代码示例。如果您正苦于以下问题:Java LifecycleComponent类的具体用法?Java LifecycleComponent怎么用?Java LifecycleComponent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LifecycleComponent类属于org.elasticsearch.common.component包,在下文中一共展示了LifecycleComponent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startServices
import org.elasticsearch.common.component.LifecycleComponent; //导入依赖的package包/类
private void startServices(Injector injector, Plugin plugin, Settings settings, ClassLoader classLoader, URL url)
throws IOException {
for (Class<? extends LifecycleComponent> service : plugin.nodeServices()) {
logger.info("found service {} {} to start", service, service.getClass());
LifecycleComponent t = injector.getInstance(service);
if (t instanceof DeployableComponent) {
DeployableComponent component = (DeployableComponent) t;
logger.info("before init component {}", component);
// add custom settings from elasticsearch.yml
URL settingsUrl = classLoader.getResource("elasticsearch.yml");
if (settingsUrl != null) {
Settings customSettings = settingsBuilder()
.put(settings)
.loadFromStream("elasticsearch.yml", settingsUrl.openStream())
.build();
logger.info("custom settings = {}", customSettings.getAsMap());
component.init(customSettings, classLoader, url);
logger.info("after component {}", component);
}
}
logger.info("starting service {}", service);
t.start();
logger.info("service {} started", service);
}
}
示例2: ClientTemplate
import org.elasticsearch.common.component.LifecycleComponent; //导入依赖的package包/类
private ClientTemplate(Injector injector, List<LifecycleComponent> pluginLifecycleComponents,
TransportClientNodesService nodesService, TransportProxyClient proxy, NamedWriteableRegistry namedWriteableRegistry) {
this.injector = injector;
this.pluginLifecycleComponents = pluginLifecycleComponents;
this.nodesService = nodesService;
this.proxy = proxy;
this.namedWriteableRegistry = namedWriteableRegistry;
}
示例3: close
import org.elasticsearch.common.component.LifecycleComponent; //导入依赖的package包/类
/**
* Closes the client.
*/
@Override
public void close() {
List<Closeable> closeables = new ArrayList<>();
closeables.add(nodesService);
closeables.add(injector.getInstance(TransportService.class));
for (LifecycleComponent plugin : pluginLifecycleComponents) {
closeables.add(plugin);
}
closeables.add(() -> ThreadPool.terminate(injector.getInstance(ThreadPool.class), 10, TimeUnit.SECONDS));
closeables.add(injector.getInstance(BigArrays.class));
IOUtils.closeWhileHandlingException(closeables);
}
示例4: stop
import org.elasticsearch.common.component.LifecycleComponent; //导入依赖的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;
}
示例5: getGuiceServiceClasses
import org.elasticsearch.common.component.LifecycleComponent; //导入依赖的package包/类
/** Returns all classes injected into guice by plugins which extend {@link LifecycleComponent}. */
public Collection<Class<? extends LifecycleComponent>> getGuiceServiceClasses() {
List<Class<? extends LifecycleComponent>> services = new ArrayList<>();
for (Tuple<PluginInfo, Plugin> plugin : plugins) {
services.addAll(plugin.v2().getGuiceServiceClasses());
}
return services;
}
示例6: nodeServices
import org.elasticsearch.common.component.LifecycleComponent; //导入依赖的package包/类
@Override
public Collection<Class<? extends LifecycleComponent>> nodeServices() {
// only start the service if we have a data node
if (!settings.getAsBoolean("node.client", false)) {
Collection<Class<? extends LifecycleComponent>> services = Lists.newArrayList();
services.add(BlobService.class);
return services;
}
return super.nodeServices();
}
示例7: nodeServices
import org.elasticsearch.common.component.LifecycleComponent; //导入依赖的package包/类
public Collection<Class<? extends LifecycleComponent>> nodeServices() {
List<Class<? extends LifecycleComponent>> services = Lists.newArrayList();
for (Plugin plugin : plugins) {
services.addAll(plugin.nodeServices());
services.addAll(plugin.services());
}
return services;
}
示例8: nodeServices
import org.elasticsearch.common.component.LifecycleComponent; //导入依赖的package包/类
@Override
public Collection<Class<? extends LifecycleComponent>> nodeServices() {
return ImmutableList.<Class<? extends LifecycleComponent>>of(
DecommissioningService.class,
BulkRetryCoordinatorPool.class,
NodeDisconnectJobMonitorService.class,
JobContextService.class);
}
示例9: nodeServices
import org.elasticsearch.common.component.LifecycleComponent; //导入依赖的package包/类
@Override
public Collection<Class<? extends LifecycleComponent>> nodeServices() {
Collection<Class<? extends LifecycleComponent>> services = Lists.newArrayList();
services.addAll(pluginLoader.nodeServices());
services.addAll(crateComponentLoader.nodeServices());
services.add(AuthService.class);
return services;
}
示例10: nodeServices
import org.elasticsearch.common.component.LifecycleComponent; //导入依赖的package包/类
public Collection<Class<? extends LifecycleComponent>> nodeServices() {
List<Class<? extends LifecycleComponent>> services = Lists.newArrayList();
for (Plugin plugin : plugins) {
services.addAll(plugin.nodeServices());
}
return services;
}
示例11: stop
import org.elasticsearch.common.component.LifecycleComponent; //导入依赖的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;
}
示例12: nodeServices
import org.elasticsearch.common.component.LifecycleComponent; //导入依赖的package包/类
public Collection<Class<? extends LifecycleComponent>> nodeServices() {
List<Class<? extends LifecycleComponent>> services = new ArrayList<>();
for (Tuple<PluginInfo, Plugin> plugin : plugins) {
services.addAll(plugin.v2().nodeServices());
}
return services;
}
示例13: nodeServices
import org.elasticsearch.common.component.LifecycleComponent; //导入依赖的package包/类
@Override
public Collection<Class<? extends LifecycleComponent>> nodeServices() {
Collection<Class<? extends LifecycleComponent>> components = Lists.newArrayList();
if (!enable) {
return components;
}
components.add(PluginSettings.class);
components.add(PluginInit.class);
return components;
}
示例14: nodeServices
import org.elasticsearch.common.component.LifecycleComponent; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public Collection<Class<? extends LifecycleComponent>> nodeServices() {
final Collection<Class<? extends LifecycleComponent>> services = Lists.newArrayList();
services.add(GeoHeatmapService.class);
return services;
}
示例15: nodeServices
import org.elasticsearch.common.component.LifecycleComponent; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public Collection<Class<? extends LifecycleComponent>> nodeServices() {
Collection<Class<? extends LifecycleComponent>> services = Lists.newArrayList();
services.addAll(searchguard.nodeServices());
services.addAll(sgSSL.nodeServices());
services.add(OpenShiftElasticSearchService.class);
return services;
}