String clusterName = GridContactManager.getClusterName(ClusterType.ElasticSearch, clusterID);
String esHosts = LogConf.getESUnicastHosts(clusterID);
String[] masterNodes = esHosts.split(StringUtil.COMMA);
HttpHost[] hostsArr = new HttpHost[masterNodes.length];
for (int i = 0; i < masterNodes.length; i++)
{
String masterIp = masterNodes[i];
HttpHost host = new HttpHost(masterIp, 9200, "http");//No I18N
hostsArr[i] = host;
}
RestClient restClient = RestClient.builder(hostsArr).build();
return restClient;
When I check the number of requests periodically via netstat
, the number of requests keeps increasing. I am initializing the restClient with the above code, and this code runs only once, so am not creating multiple RestClients. I use restClient.performRequest for all the search operations and also I am not closing the restClient anywhere.
Result of this netstat | grep "9200" | wc -l
is as follows
After initializing the server - 7
After 50 searches - 103
After 100 searches - 202
For now, I am running this on my development machine with a single node.