# Stop in the name of Love

**URL:** https://discuss.elastic.co/t/stop-in-the-name-of-love/4190
**Category:** Elasticsearch
**Created:** [April 5, 2011, 4:12pm UTC](https://discuss.elastic.co/t/stop-in-the-name-of-love/4190 "2011-04-05T16:12:17Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![zohar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zohar/32/3245_2.png) [@zohar](https://discuss.elastic.co/u/zohar)
#### Post date: [April 5, 2011, 4:12pm UTC](https://discuss.elastic.co/t/stop-in-the-name-of-love/4190/1 "2011-04-05T16:12:17Z")

</div>

Hi  
As part of put tests we try and stop elastic , delete the index dir , and re start later - just so we start with a clean slate.

we do :

```
    if (node != null) {
        node.close();
    }

    if (elasticSearchClient != null) {
        elasticSearchClient.close();
    }

```

however occasionally when the call returns the files are still locked and we fail to delete the directory.  
Is there a better way?

Cheers  
Z

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [April 6, 2011, 9:28am UTC](https://discuss.elastic.co/t/stop-in-the-name-of-love/4190/2 "2011-04-06T09:28:32Z")

</div>

If you can post a recreation I can have a look. Usually its better to close the client before the node itself (just to create less ripples).  
On Tuesday, April 5, 2011 at 7:12 PM, zohar wrote:

> Hi  
> As part of put tests we try and stop elastic , delete the index dir , and  
> re start later - just so we start with a clean slate.
> 
> we do :
> 
> if (node != null) {  
> node.close();  
> }
> 
> if (elasticSearchClient != null) {  
> elasticSearchClient.close();  
> }
> 
> however occasionally when the call returns the files are still locked and we  
> fail to delete the directory.  
> Is there a better way?
> 
> Cheers  
> Z
> 
> --  
> View this message in context: [http://elasticsearch-users.115913.n3.nabble.com/Stop-in-the-name-of-Love-tp2780480p2780480.html](http://elasticsearch-users.115913.n3.nabble.com/Stop-in-the-name-of-Love-tp2780480p2780480.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 4:08am UTC](https://discuss.elastic.co/t/stop-in-the-name-of-love/4190/3 "2017-07-06T04:08:51Z")

</div>


