ElasticSearch Connection goes into a limbo without throwing an exception

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

ElasticSearch Connection goes into a limbo without throwing an exception

vaidabhishek
This post has NOT been accepted by the mailing list yet.
- I'm using a Java Transport Client to connect to an ES cluster. My settings are as following:

        Settings settings = ImmutableSettings
                .settingsBuilder()
                .put("cluster.name", clusterName)
                .put("client.transport.ping_timeout", "30s")
                .put("client.transport.nodes_sampler_interval", "30s")
                .put("client.transport.sniff", false)
                .build();

        TransportClient esClient = new TransportClient(settings);

        for (String host: clusterHostList)
            esClient.addTransportAddresses(new InetSocketTransportAddress(host, esPort));

- I want to create a connection which stays alive for hours in case of inactivity. So, I'm following a singleton pattern by maintaining only one connection to my cluster. However, the code where I'm invoking the client for a search, I am catching the exception (if any) caused by the connection, in which case I re-establish the connection by above code.

- The problem is that after a few minutes of inactivity, the connection times out without throwing any exception. This is causing me serious problems.

- Can anyone help me in this situation.