Added finally block

This commit is contained in:
keithhc2 2021-10-22 11:48:16 -07:00
parent 375eb2cefe
commit 0d78441e76
1 changed files with 10 additions and 3 deletions

View File

@ -140,10 +140,17 @@ public class OpenSearchClientExample {
DeleteResponse deleteResponse = client.indices().delete(deleteRequest);
restClient.close();
}
catch (IOException e){
} catch (IOException e){
System.out.println(e.toString());
}
} finally {
try {
if (client != null) {
client.close();
}
} catch (IOException e) {
System.out.println(e.toString());
}
}
}
}
```