# HG changeset patch # User Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com> # Date 1642758094 -3600 # Node ID ea8e3d011632104af69859f94952111511f3d25e # Parent 24c49b65bc3b13eeb34ae3b9656ab7a2174eee5c Allow setting socket read timeout on Control (contributed by Wouter Alink) diff --git a/src/main/java/org/monetdb/merovingian/Control.java b/src/main/java/org/monetdb/merovingian/Control.java --- 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 {