Added finally block
This commit is contained in:
parent
375eb2cefe
commit
0d78441e76
|
@ -140,10 +140,17 @@ public class OpenSearchClientExample {
|
||||||
DeleteResponse deleteResponse = client.indices().delete(deleteRequest);
|
DeleteResponse deleteResponse = client.indices().delete(deleteRequest);
|
||||||
|
|
||||||
restClient.close();
|
restClient.close();
|
||||||
}
|
} catch (IOException e){
|
||||||
catch (IOException e){
|
|
||||||
System.out.println(e.toString());
|
System.out.println(e.toString());
|
||||||
}
|
} finally {
|
||||||
|
try {
|
||||||
|
if (client != null) {
|
||||||
|
client.close();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.out.println(e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue