Mercurial > hg > monetdb-java
changeset 630:ea8e3d011632
Allow setting socket read timeout on Control
(contributed by Wouter Alink)
author | Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com> |
---|---|
date | Fri, 21 Jan 2022 10:41:34 +0100 (2022-01-21) |
parents | 24c49b65bc3b |
children | 0674e6fb4bdd |
files | src/main/java/org/monetdb/merovingian/Control.java |
diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/org/monetdb/merovingian/Control.java +++ b/src/main/java/org/monetdb/merovingian/Control.java @@ -51,6 +51,7 @@ public class Control { private final String passphrase; /** The file we should write MapiSocket debuglog to */ private String debug; + private int soTimeout = -1; /* -1 means not initialized */ /** @@ -69,6 +70,15 @@ public class Control { this.port = port; this.passphrase = passphrase; } + + /** + * Sets the socket timeout. + * + * @param timeout (in milliseconds) Use -1 to unset timeout (and use default) + */ + public void setSoTimeout(int timeout) { + soTimeout = timeout; + } /** * Instructs to write a MCL protocol debug log to the given file. @@ -121,6 +131,8 @@ public class Control { MapiSocket ms = new MapiSocket(); ms.setDatabase("merovingian"); ms.setLanguage("control"); + if (soTimeout != -1) + ms.setSoTimeout(soTimeout); if (debug != null) ms.debug(debug); try {