Merge branch 'master' into ingest_plugin_api

This commit is contained in:
Ryan Ernst 2016-07-01 12:58:11 -07:00
commit 2f12d1cb45
3 changed files with 14 additions and 19 deletions

View File

@ -32,6 +32,7 @@ import org.elasticsearch.cluster.routing.allocation.command.CancelAllocationComm
import org.elasticsearch.cluster.routing.allocation.command.MoveAllocationCommand; import org.elasticsearch.cluster.routing.allocation.command.MoveAllocationCommand;
import org.elasticsearch.common.ParseField; import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.inject.AbstractModule; import org.elasticsearch.common.inject.AbstractModule;
import org.elasticsearch.common.inject.util.Providers;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry; import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Setting;
@ -166,6 +167,8 @@ public class NetworkModule extends AbstractModule {
if (HTTP_ENABLED.get(settings)) { if (HTTP_ENABLED.get(settings)) {
bind(HttpServer.class).asEagerSingleton(); bind(HttpServer.class).asEagerSingleton();
httpTransportTypes.bindType(binder(), settings, HTTP_TYPE_SETTING.getKey(), NETTY_TRANSPORT); httpTransportTypes.bindType(binder(), settings, HTTP_TYPE_SETTING.getKey(), NETTY_TRANSPORT);
} else {
bind(HttpServer.class).toProvider(Providers.of(null));
} }
// Bind the AllocationCommandRegistry so RestClusterRerouteAction can get it. // Bind the AllocationCommandRegistry so RestClusterRerouteAction can get it.
bind(AllocationCommandRegistry.class).toInstance(allocationCommandRegistry); bind(AllocationCommandRegistry.class).toInstance(allocationCommandRegistry);

View File

@ -30,6 +30,7 @@ import org.elasticsearch.action.admin.cluster.node.info.NodeInfo;
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats; import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags; import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags;
import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.component.AbstractComponent;
import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
@ -59,14 +60,16 @@ public class NodeService extends AbstractComponent implements Closeable {
private final SettingsFilter settingsFilter; private final SettingsFilter settingsFilter;
private ClusterService clusterService; private ClusterService clusterService;
private ScriptService scriptService; private ScriptService scriptService;
private final HttpServer httpServer;
@Nullable
private HttpServer httpServer;
private final Discovery discovery; private final Discovery discovery;
@Inject @Inject
public NodeService(Settings settings, ThreadPool threadPool, MonitorService monitorService, Discovery discovery, public NodeService(Settings settings, ThreadPool threadPool, MonitorService monitorService, Discovery discovery,
TransportService transportService, IndicesService indicesService, PluginsService pluginService, TransportService transportService, IndicesService indicesService, PluginsService pluginService,
CircuitBreakerService circuitBreakerService, ScriptService scriptService, HttpServer httpServer, CircuitBreakerService circuitBreakerService, ScriptService scriptService, @Nullable HttpServer httpServer,
IngestService ingestService, ClusterService clusterService, SettingsFilter settingsFilter) { IngestService ingestService, ClusterService clusterService, SettingsFilter settingsFilter) {
super(settings); super(settings);
this.threadPool = threadPool; this.threadPool = threadPool;
@ -93,7 +96,7 @@ public class NodeService extends AbstractComponent implements Closeable {
monitorService.jvmService().info(), monitorService.jvmService().info(),
threadPool.info(), threadPool.info(),
transportService.info(), transportService.info(),
httpServer.info(), httpServer == null ? null : httpServer.info(),
pluginService == null ? null : pluginService.info(), pluginService == null ? null : pluginService.info(),
ingestService == null ? null : ingestService.info(), ingestService == null ? null : ingestService.info(),
indicesService.getTotalIndexingBufferBytes() indicesService.getTotalIndexingBufferBytes()
@ -109,7 +112,7 @@ public class NodeService extends AbstractComponent implements Closeable {
jvm ? monitorService.jvmService().info() : null, jvm ? monitorService.jvmService().info() : null,
threadPool ? this.threadPool.info() : null, threadPool ? this.threadPool.info() : null,
transport ? transportService.info() : null, transport ? transportService.info() : null,
http ? httpServer.info() : null, http ? (httpServer == null ? null : httpServer.info()) : null,
plugin ? (pluginService == null ? null : pluginService.info()) : null, plugin ? (pluginService == null ? null : pluginService.info()) : null,
ingest ? (ingestService == null ? null : ingestService.info()) : null, ingest ? (ingestService == null ? null : ingestService.info()) : null,
indices ? indicesService.getTotalIndexingBufferBytes() : null indices ? indicesService.getTotalIndexingBufferBytes() : null
@ -127,7 +130,7 @@ public class NodeService extends AbstractComponent implements Closeable {
threadPool.stats(), threadPool.stats(),
monitorService.fsService().stats(), monitorService.fsService().stats(),
transportService.stats(), transportService.stats(),
httpServer.stats(), httpServer == null ? null : httpServer.stats(),
circuitBreakerService.stats(), circuitBreakerService.stats(),
scriptService.stats(), scriptService.stats(),
discovery.stats(), discovery.stats(),

View File

@ -18,7 +18,8 @@
*/ */
package org.elasticsearch.http; package org.elasticsearch.http;
import org.elasticsearch.cluster.service.ClusterService; import java.util.Map;
import org.elasticsearch.common.breaker.CircuitBreaker; import org.elasticsearch.common.breaker.CircuitBreaker;
import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.bytes.BytesReference;
@ -32,8 +33,6 @@ import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.indices.breaker.CircuitBreakerService; import org.elasticsearch.indices.breaker.CircuitBreakerService;
import org.elasticsearch.indices.breaker.HierarchyCircuitBreakerService; import org.elasticsearch.indices.breaker.HierarchyCircuitBreakerService;
import org.elasticsearch.ingest.IngestService;
import org.elasticsearch.node.service.NodeService;
import org.elasticsearch.rest.AbstractRestChannel; import org.elasticsearch.rest.AbstractRestChannel;
import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.BytesRestResponse;
import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestController;
@ -43,11 +42,6 @@ import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.ESTestCase;
import org.junit.Before; import org.junit.Before;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.Map;
public class HttpServerTests extends ESTestCase { public class HttpServerTests extends ESTestCase {
private static final ByteSizeValue BREAKER_LIMIT = new ByteSizeValue(20); private static final ByteSizeValue BREAKER_LIMIT = new ByteSizeValue(20);
private HttpServer httpServer; private HttpServer httpServer;
@ -73,12 +67,7 @@ public class HttpServerTests extends ESTestCase {
throw new IllegalArgumentException("test error"); throw new IllegalArgumentException("test error");
}); });
ClusterService clusterService = new ClusterService(Settings.EMPTY, httpServer = new HttpServer(settings, httpServerTransport, restController, null, circuitBreakerService);
new ClusterSettings(settings, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS), null);
IngestService ingestService = new IngestService(settings, null, null, null, Collections.emptyList());
NodeService nodeService = new NodeService(Settings.EMPTY, null, null, null, null, null, null, null,
ingestService, clusterService, null);
httpServer = new HttpServer(settings, httpServerTransport, restController, nodeService, null, circuitBreakerService);
httpServer.start(); httpServer.start();
} }