You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2022/03/24 09:22:07 UTC
[directory-ldap-api] branch master updated: Make the timeout infinite when set to -1
This is an automated email from the ASF dual-hosted git repository.
elecharny pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-ldap-api.git
The following commit(s) were added to refs/heads/master by this push:
new 7cb2d24 Make the timeout infinite when set to -1
7cb2d24 is described below
commit 7cb2d245bbc0afdaa860e1c6afea84b3dca54809
Author: emmanuel lecharny <el...@apache.org>
AuthorDate: Thu Mar 24 10:21:56 2022 +0100
Make the timeout infinite when set to -1
---
.../ldap/client/api/LdapConnectionConfig.java | 74 ++++++++++++++++++----
1 file changed, 62 insertions(+), 12 deletions(-)
diff --git a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionConfig.java b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionConfig.java
index 7089e80..ace7201 100644
--- a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionConfig.java
+++ b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionConfig.java
@@ -337,12 +337,20 @@ public class LdapConnectionConfig
* It is used when operation-specific timeouts are not specified.
* It is also used for extended operations.
*
- * @param timeout the timeout in milliseconds to set
+ * @param timeout the timeout in milliseconds to set. If < 0, will be set to infinite
*/
public void setTimeout( long timeout )
{
- this.timeout = timeout;
+ if ( timeout == -1L )
+ {
+ this.timeout = Long.MAX_VALUE;
+ }
+ else
+ {
+ this.timeout = timeout;
+ }
}
+
/**
* Gets connect timeout in milliseconds.
@@ -355,18 +363,27 @@ public class LdapConnectionConfig
{
return connectTimeout;
}
+
/**
* Sets connect timeout in milliseconds.
* Connect timeout is applied to connect and bind operations.
* If not specified, global timeout setting is applied.
*
- * @param timeout the timeout in milliseconds to set
+ * @param timeout the timeout in milliseconds to set. If < 0, will be set to infinite
*/
public void setConnectTimeout( Long timeout )
{
- this.connectTimeout = timeout;
+ if ( timeout == -1L )
+ {
+ this.connectTimeout = Long.MAX_VALUE;
+ }
+ else
+ {
+ this.connectTimeout = timeout;
+ }
}
+
/**
* Gets write operation timeout in milliseconds.
@@ -379,18 +396,27 @@ public class LdapConnectionConfig
{
return writeOperationTimeout;
}
+
/**
* Sets write operation timeout in milliseconds.
* Write operation timeout is applied to operations that write data, such as add, modify and delete.
* If not specified, global timeout setting is applied.
*
- * @param timeout the timeout in milliseconds to set
+ * @param timeout the timeout in milliseconds to set. If < 0, will be set to infinite
*/
public void setWriteOperationTimeout( Long timeout )
{
- this.writeOperationTimeout = timeout;
+ if ( timeout == -1L )
+ {
+ this.writeOperationTimeout = Long.MAX_VALUE;
+ }
+ else
+ {
+ this.writeOperationTimeout = timeout;
+ }
}
+
/**
* Gets read operation timeout in milliseconds.
@@ -403,18 +429,27 @@ public class LdapConnectionConfig
{
return readOperationTimeout;
}
+
/**
* Sets read operation timeout in milliseconds.
* This timeout is applied to read operations, such as search and compare.
* If not specified, global timeout setting is applied.
*
- * @param timeout the timeout in milliseconds to set
+ * @param timeout the timeout in milliseconds to set. If < 0, will be set to infinite
*/
public void setReadOperationTimeout( Long timeout )
{
- this.readOperationTimeout = timeout;
+ if ( timeout == -1L )
+ {
+ this.readOperationTimeout = Long.MAX_VALUE;
+ }
+ else
+ {
+ this.readOperationTimeout = timeout;
+ }
}
+
/**
* Gets close timeout in milliseconds.
@@ -434,13 +469,21 @@ public class LdapConnectionConfig
* Close timeout is applied to close and unbind operations.
* If not specified, global timeout setting is applied.
*
- * @param timeout the timeout in milliseconds to set
+ * @param timeout the timeout in milliseconds to set. If < 0, will be set to infinite
*/
public void setCloseTimeout( Long timeout )
{
- this.closeTimeout = timeout;
+ if ( timeout == -1L )
+ {
+ this.closeTimeout = Long.MAX_VALUE;
+ }
+ else
+ {
+ this.closeTimeout = timeout;
+ }
}
+
/**
* Gets send timeout in milliseconds.
* Send timeout is used for I/O (TCP) write operations.
@@ -459,11 +502,18 @@ public class LdapConnectionConfig
* Send timeout is used for I/O (TCP) write operations.
* If not specified, global timeout setting is applied.
*
- * @param timeout the timeout in milliseconds to set
+ * @param timeout the timeout in milliseconds to set. If < 0, will be set to infinite
*/
public void setSendTimeout( Long timeout )
{
- this.sendTimeout = timeout;
+ if ( timeout == -1L )
+ {
+ this.sendTimeout = Long.MAX_VALUE;
+ }
+ else
+ {
+ this.sendTimeout = timeout;
+ }
}