When a Java process with ES Client terminate, does it automatically close the connection?

Hi all,

A question on Java API for ElasticSearch. When a Java process with ES
Client terminate, does it automatically close the connection? Or we should
explicitly close the connection to save the resources?

Best regards,

Arinto

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/27516684-8413-4e2c-9c44-021baf85b952%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Yes, you should always call close() in your code if you want to exit.

There is no automatic call to client close() when a JVM exits.

If the JVM exits, connections will be aborted and throw errors, mostly you
can see them in the cluster logs (IOExceptions, "connection reset by peer",
or timeouts).

If the client is closed with close(), the resources the client holds are
released back to the JVM (connections/sockets, thread pool, caches). ES
waits for threads to complete if they are active. Also in this case, open
connections will be forcefully closed, even if operations (executed by
other threads using the client) are still ongoing, but the message will be
different, the cluster can react gracefully.

Jörg

On Tue, Feb 25, 2014 at 10:07 AM, Arinto Murdopo arinto@gmail.com wrote:

Hi all,

A question on Java API for Elasticsearch. When a Java process with ES
Client terminate, does it automatically close the connection? Or we should
explicitly close the connection to save the resources?

Best regards,

Arinto

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/27516684-8413-4e2c-9c44-021baf85b952%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoFPv%2BU0ACptRcgUs9%3D%2BAx%2B0Ayox_923dpHYMHS0bwzAVQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.