Search in sources :

Example 21 with Transport

use of org.elasticsearch.transport.Transport in project elasticsearch by elastic.

the class MockTransportService method createNewService.

public static MockTransportService createNewService(Settings settings, Version version, ThreadPool threadPool, @Nullable ClusterSettings clusterSettings) {
    NamedWriteableRegistry namedWriteableRegistry = new NamedWriteableRegistry(ClusterModule.getNamedWriteables());
    final Transport transport = new MockTcpTransport(settings, threadPool, BigArrays.NON_RECYCLING_INSTANCE, new NoneCircuitBreakerService(), namedWriteableRegistry, new NetworkService(settings, Collections.emptyList()), version);
    return createNewService(settings, transport, version, threadPool, clusterSettings);
}
Also used : NamedWriteableRegistry(org.elasticsearch.common.io.stream.NamedWriteableRegistry) NetworkService(org.elasticsearch.common.network.NetworkService) Transport(org.elasticsearch.transport.Transport) MockTcpTransport(org.elasticsearch.transport.MockTcpTransport) MockTcpTransport(org.elasticsearch.transport.MockTcpTransport) NoneCircuitBreakerService(org.elasticsearch.indices.breaker.NoneCircuitBreakerService)

Example 22 with Transport

use of org.elasticsearch.transport.Transport in project elasticsearch-suggest-plugin by spinscale.

the class TransportClientTest method getTransportClient.

private TransportClient getTransportClient() {
    if (transportClient == null) {
        transportClient = new TransportClient(settingsBuilder().put("cluster.name", internalCluster().getClusterName()).put("name", "programmatic_transport_client").put("client.transport.nodes_sampler_interval", "1s").build());
        Transport transport = internalCluster().getDataNodeInstance(Transport.class);
        transportClient.addTransportAddress(transport.boundAddress().publishAddress());
    }
    return transportClient;
}
Also used : TransportClient(org.elasticsearch.client.transport.TransportClient) Transport(org.elasticsearch.transport.Transport)

Aggregations

Transport (org.elasticsearch.transport.Transport)22 NamedWriteableRegistry (org.elasticsearch.common.io.stream.NamedWriteableRegistry)18 NetworkService (org.elasticsearch.common.network.NetworkService)15 Settings (org.elasticsearch.common.settings.Settings)14 NoneCircuitBreakerService (org.elasticsearch.indices.breaker.NoneCircuitBreakerService)14 ThreadPool (org.elasticsearch.threadpool.ThreadPool)14 TransportService (org.elasticsearch.transport.TransportService)14 DiscoveryNode (org.elasticsearch.cluster.node.DiscoveryNode)13 TransportAddress (org.elasticsearch.common.transport.TransportAddress)13 TestThreadPool (org.elasticsearch.threadpool.TestThreadPool)13 MockTcpTransport (org.elasticsearch.transport.MockTcpTransport)13 BigArrays (org.elasticsearch.common.util.BigArrays)12 MockTransportService (org.elasticsearch.test.transport.MockTransportService)12 Collections (java.util.Collections)11 Logger (org.apache.logging.log4j.Logger)11 BoundTransportAddress (org.elasticsearch.common.transport.BoundTransportAddress)11 UnknownHostException (java.net.UnknownHostException)10 List (java.util.List)10 Map (java.util.Map)10 TimeUnit (java.util.concurrent.TimeUnit)10