From 6cf9787f7be9408909c18630175ab4e2ff370ebf Mon Sep 17 00:00:00 2001 From: Douglas Heriot Date: Wed, 8 Jul 2020 14:02:46 +1000 Subject: [PATCH] GUACAMOLE-919: Fix style issues, improve comments. --- ...ostgreSQLAuthenticationProviderModule.java | 2 +- .../conf/PostgreSQLEnvironment.java | 19 ++++++++++--------- .../conf/PostgreSQLGuacamoleProperties.java | 4 ++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/java/org/apache/guacamole/auth/postgresql/PostgreSQLAuthenticationProviderModule.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/java/org/apache/guacamole/auth/postgresql/PostgreSQLAuthenticationProviderModule.java index 5241e1276..0ec44cd78 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/java/org/apache/guacamole/auth/postgresql/PostgreSQLAuthenticationProviderModule.java +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/java/org/apache/guacamole/auth/postgresql/PostgreSQLAuthenticationProviderModule.java @@ -72,7 +72,7 @@ public class PostgreSQLAuthenticationProviderModule implements Module { // Only set if > 0. Underlying backend does not take 0 as not-set. int defaultStatementTimeout = environment.getPostgreSQLDefaultStatementTimeout(); - if(defaultStatementTimeout > 0) { + if (defaultStatementTimeout > 0) { myBatisProperties.setProperty("mybatis.configuration.defaultStatementTimeout", String.valueOf(defaultStatementTimeout)); } diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/java/org/apache/guacamole/auth/postgresql/conf/PostgreSQLEnvironment.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/java/org/apache/guacamole/auth/postgresql/conf/PostgreSQLEnvironment.java index 7ce4795ce..ba77c2608 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/java/org/apache/guacamole/auth/postgresql/conf/PostgreSQLEnvironment.java +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/java/org/apache/guacamole/auth/postgresql/conf/PostgreSQLEnvironment.java @@ -49,17 +49,18 @@ public class PostgreSQLEnvironment extends JDBCEnvironment { private static final int DEFAULT_PORT = 5432; /** - * The default defaultStatementTimeout (in seconds), - * if POSTGRESQL_DEFAULT_STATEMENT_TIMEOUT is not specified. - * Default to 0 (no timeout, property won't be set) - * https://mybatis.org/mybatis-3/configuration.html + * The default number of seconds the driver will wait for a response from + * the database. A value of 0 (the default) means the timeout is disabled. */ - private static final int DEFAULT_DEFAULT_STATEMENT_TIMEOUT = 0; + private static final int DEFAULT_STATEMENT_TIMEOUT = 0; /** - * The default socketTimeout (in seconds), if POSTGRESQL_SOCKET_TIMEOUT is not specified. - * Default to 0 (no timeout) - * https://jdbc.postgresql.org/documentation/head/connect.html + * The default timeout (in seconds) used for socket read operations. + * If reading from the server takes longer than this value, the + * connection is closed. This can be used to handle network problems + * such as a dropped connection to the database. Similar to + * DEFAULT_STATEMENT_TIMEOUT, it will also abort queries that take too + * long. The value 0 (the default) means the timeout is disabled. */ private static final int DEFAULT_SOCKET_TIMEOUT = 0; @@ -279,7 +280,7 @@ public class PostgreSQLEnvironment extends JDBCEnvironment { public int getPostgreSQLDefaultStatementTimeout() throws GuacamoleException { return getProperty( PostgreSQLGuacamoleProperties.POSTGRESQL_DEFAULT_STATEMENT_TIMEOUT, - DEFAULT_DEFAULT_STATEMENT_TIMEOUT + DEFAULT_STATEMENT_TIMEOUT ); } diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/java/org/apache/guacamole/auth/postgresql/conf/PostgreSQLGuacamoleProperties.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/java/org/apache/guacamole/auth/postgresql/conf/PostgreSQLGuacamoleProperties.java index feaf85536..2feee8085 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/java/org/apache/guacamole/auth/postgresql/conf/PostgreSQLGuacamoleProperties.java +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/java/org/apache/guacamole/auth/postgresql/conf/PostgreSQLGuacamoleProperties.java @@ -95,7 +95,7 @@ public class PostgreSQLGuacamoleProperties { }; /** - * Sets the number of seconds the driver will wait for + * The number of seconds the driver will wait for * a response from the database. */ public static final IntegerGuacamoleProperty @@ -107,7 +107,7 @@ public class PostgreSQLGuacamoleProperties { }; /** - * Sets the number of seconds the driver will wait in a read() call + * The number of seconds the driver will wait in a read() call * on the TCP connection to the database. */ public static final IntegerGuacamoleProperty