W3cubDocs

/RethinkDB Java

ReQL command: reconnect

Command syntax

conn.reconnect([boolean, timeout])

Description

Close and reopen a connection.

Closing a connection normally waits until all outstanding requests have finished and then frees any open resources associated with the connection. By passing false as an optional boolean argument to reconnect, the connection will be closed immediately, possibly aborting any outstanding noreply writes. An optional second argument is a (long integer) timeout indicating how long you would like reconnect to wait before closing the existing connection.

A noreply query is executed by using the runNoReply command, indicating that the command should not wait for the query to complete before returning. You may also explicitly wait for a noreply query to complete by using the noreplyWait command.

Example: Cancel outstanding requests/queries that are no longer needed.

conn.reconnect(false);

Example: Wait up to 5 seconds for outstanding requests to finish before reconnecting.

conn.reconnect(true, 5);

Related commands

Get more help

Couldn't find what you were looking for?

© RethinkDB contributors
Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
https://rethinkdb.com/api/java/reconnect/