From 20b1dbf00f806146789ce2f04d17e44e79c1f25d Mon Sep 17 00:00:00 2001 From: Douglas Heriot Date: Wed, 15 Jul 2020 18:46:45 +1000 Subject: [PATCH] GUACAMOLE-919: More updates to style and comments. --- ...PostgreSQLAuthenticationProviderModule.java | 10 ++++++++-- .../postgresql/conf/PostgreSQLEnvironment.java | 15 ++++++--------- .../conf/PostgreSQLGuacamoleProperties.java | 18 ++++++++++++------ 3 files changed, 26 insertions(+), 17 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 0ec44cd78..280cead71 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 @@ -73,7 +73,10 @@ 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) { - myBatisProperties.setProperty("mybatis.configuration.defaultStatementTimeout", String.valueOf(defaultStatementTimeout)); + myBatisProperties.setProperty( + "mybatis.configuration.defaultStatementTimeout", + String.valueOf(defaultStatementTimeout) + ); } // Use UTF-8 in database @@ -117,7 +120,10 @@ public class PostgreSQLAuthenticationProviderModule implements Module { } // Handle case where TCP connection to database is silently dropped - driverProperties.setProperty("socketTimeout", String.valueOf(environment.getPostgreSQLSocketTimeout())); + driverProperties.setProperty( + "socketTimeout", + String.valueOf(environment.getPostgreSQLSocketTimeout()) + ); } 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 ba77c2608..012877cf6 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 @@ -50,17 +50,14 @@ public class PostgreSQLEnvironment extends JDBCEnvironment { /** * 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. + * the database, before aborting the query. + * A value of 0 (the default) means the timeout is disabled. */ private static final int DEFAULT_STATEMENT_TIMEOUT = 0; /** - * 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. + * The default number of seconds to wait for socket read operations. + * A value of 0 (the default) means the timeout is disabled. */ private static final int DEFAULT_SOCKET_TIMEOUT = 0; @@ -268,7 +265,7 @@ public class PostgreSQLEnvironment extends JDBCEnvironment { /** * Returns the defaultStatementTimeout set for PostgreSQL connections. - * If unspecified, this will be the default 0, + * If unspecified, this will default to 0, * and should not be passed through to the backend. * * @return @@ -286,7 +283,7 @@ public class PostgreSQLEnvironment extends JDBCEnvironment { /** * Returns the socketTimeout property to set on PostgreSQL connections. - * If unspecified, this will be the default to 0 (no timeout) + * If unspecified, this will default to 0 (no timeout) * * @return * The socketTimeout to use when waiting on read operations (in seconds) 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 2feee8085..271d9c0dd 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,11 +95,12 @@ public class PostgreSQLGuacamoleProperties { }; /** - * The number of seconds the driver will wait for - * a response from the database. + * The number of seconds the driver will wait for a response from + * the database, before aborting the query. + * A value of 0 (the default) means the timeout is disabled. */ public static final IntegerGuacamoleProperty - POSTGRESQL_DEFAULT_STATEMENT_TIMEOUT = new IntegerGuacamoleProperty(){ + POSTGRESQL_DEFAULT_STATEMENT_TIMEOUT = new IntegerGuacamoleProperty() { @Override public String getName() { return "postgresql-default-statement-timeout"; } @@ -107,11 +108,16 @@ public class PostgreSQLGuacamoleProperties { }; /** - * The number of seconds the driver will wait in a read() call - * on the TCP connection to the database. + * The number of seconds to wait for socket read operations. + * If reading from the server takes longer than this value, the + * connection will be closed. This can be used to handle network problems + * such as a dropped connection to the database. Similar to + * postgresql-default-statement-timeout, it will have the effect of + * aborting queries that take too long. + * A value of 0 (the default) means the timeout is disabled. */ public static final IntegerGuacamoleProperty - POSTGRESQL_SOCKET_TIMEOUT = new IntegerGuacamoleProperty(){ + POSTGRESQL_SOCKET_TIMEOUT = new IntegerGuacamoleProperty() { @Override public String getName() { return "postgresql-socket-timeout"; }