Skip to content

Commit

Permalink
Addressed PR Comments
Browse files Browse the repository at this point in the history
Signed-off-by: Owais Kazi <[email protected]>
  • Loading branch information
owaiskazi19 committed Jan 6, 2023
1 parent 3ff4b65 commit f57c047
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ dependencies {
implementation("org.opensearch:opensearch:${opensearchVersion}")
implementation("org.apache.logging.log4j:log4j-api:${log4jVersion}")
implementation("org.apache.logging.log4j:log4j-core:${log4jVersion}")
implementation ("org.opensearch.client:opensearch-rest-high-level-client:${opensearchVersion}")
implementation("org.opensearch.client:opensearch-rest-high-level-client:${opensearchVersion}")
implementation("org.opensearch.client:opensearch-rest-client:${opensearchVersion}")
implementation("org.opensearch.client:opensearch-java:${opensearchVersion}")
implementation("org.opensearch.plugin:transport-netty4-client:${opensearchVersion}")
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/opensearch/sdk/SDKClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
*/
public class SDKClient {
private OpenSearchClient javaClient;
private RestClient restClient = null;
private RestClient restClient;
private RestHighLevelClient highLevelClient;

private RestClientBuilder builder(String hostAddress, int port) {
Expand Down Expand Up @@ -77,7 +77,7 @@ public TlsDetails create(final SSLEngine sslEngine) {
* Creates OpenSearchClient for SDK. It also creates a restClient as a wrapper around Java OpenSearchClient
* @param hostAddress The address of OpenSearch cluster, client can connect to
* @param port The port of OpenSearch cluster
* @return SDKClient which is internally an OpenSearchClient. The user is responsible for calling {@link #doCloseRestClient()} when finished with the client
* @return The SDKClient implementation of OpenSearchClient. The user is responsible for calling {@link #doCloseJavaClient()} when finished with the client
*/
public OpenSearchClient initializeJavaClient(String hostAddress, int port) {
RestClientBuilder builder = builder(hostAddress, port);
Expand All @@ -101,7 +101,7 @@ public OpenSearchClient initializeJavaClient(String hostAddress, int port) {
* Creates High Level Rest Client for SDK.
* @param hostAddress The address of OpenSearch cluster, client can connect to
* @param port The port of OpenSearch cluster
* @return SDKClient which is internally an RestHighLevelClient. The user is responsible for calling {@link #doCloseRestClient()} when finished with the client
* @return The SDKClient implementation of RestHighLevelClient. The user is responsible for calling {@link #doCloseHighLevelClient()} when finished with the client
*/
public RestHighLevelClient initializeRestClient(String hostAddress, int port) {
RestClientBuilder builder = builder(hostAddress, port);
Expand All @@ -115,7 +115,7 @@ public RestHighLevelClient initializeRestClient(String hostAddress, int port) {
*
* @throws IOException if closing the restClient fails
*/
public void doCloseRestClient() throws IOException {
public void doCloseJavaClient() throws IOException {
if (restClient != null) {
restClient.close();
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/opensearch/sdk/TestSDKClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void testCreateJavaClient() throws Exception {
)
);

sdkClient.doCloseRestClient();
sdkClient.doCloseJavaClient();
}

@Test
Expand Down

0 comments on commit f57c047

Please sign in to comment.