public static AsyncHttpClient createClient ( Configuration configuration , int numberOfHostsBeingConnectedTo ) { AsyncHttpClientConfig . Builder cf = createClientConfig ( configuration ) ; // A Bug exists in the AsyncConnection library that leak permits on a // Connection exception (i.e. when host not listening .. hard fail) // So we do not enable connection tracking. Which is fine as the ring // buffer does the job of having a single thread talking to the backend repo (ES) // So the connection should not grow in an unmanaged way, as the ring buffer // is restricting the connections // cf.setMaximumConnectionsTotal(numberOfHostsBeingConnectedTo); cf . setMaximumConnectionsTotal ( - 1 ) ; cf . setMaximumConnectionsPerHost ( - 1 ) ; cf . setExecutorService ( getExecutorService ( numberOfHostsBeingConnectedTo ) ) ; return createClient ( cf ) ; }
Creates a AsyncHttpClient object that can be used for talking to elasticsearch