GUACAMOLE-102: Code cleanup - remove unused default parameters; improve commentary and use more standard variable names.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/2986c616 Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/2986c616 Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/2986c616 Branch: refs/heads/master Commit: 2986c616906c1a606c215594283060409f85c5a6 Parents: 06e27d3 Author: Nick Couchman <vn...@apache.org> Authored: Tue Jun 6 08:49:48 2017 -0400 Committer: Nick Couchman <vn...@apache.org> Committed: Tue Jun 6 08:49:48 2017 -0400 ---------------------------------------------------------------------- .../RestrictedGuacamoleTunnelService.java | 24 ++++++++++---------- .../auth/mysql/MySQLGuacamoleProperties.java | 12 ---------- .../PostgreSQLGuacamoleProperties.java | 9 -------- 3 files changed, 12 insertions(+), 33 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/2986c616/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/RestrictedGuacamoleTunnelService.java ---------------------------------------------------------------------- diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/RestrictedGuacamoleTunnelService.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/RestrictedGuacamoleTunnelService.java index c9999ab..fa2c99f 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/RestrictedGuacamoleTunnelService.java +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/RestrictedGuacamoleTunnelService.java @@ -188,23 +188,23 @@ public class RestrictedGuacamoleTunnelService public int compare(ModeledConnection a, ModeledConnection b) { // Active connections - int Ca = getActiveConnections(a).size(); - int Cb = getActiveConnections(b).size(); + int connA = getActiveConnections(a).size(); + int connB = getActiveConnections(b).size(); // Assigned weight - int Wa = a.getConnectionWeight(); - int Wb = b.getConnectionWeight(); + int weightA = a.getConnectionWeight(); + int weightB = b.getConnectionWeight(); - // Net weight of connections - int NWa = Ca * Wb; - int NWb = Cb * Wa; + // Calculated weight of connections + int calcWeightA = connA * weightB; + int calcWeightB = connB * weightA; - // If net weights are equal, return difference in weight - if (NWa == NWb) - return (Wa - Wb); + // If calculated weights are equal, return difference in assigned weight + if (calcWeightA == calcWeightB) + return (weightA - weightB); - // Return different in net weights - return (NWa - NWb); + // Return different in calculated weights + return (calcWeightA - calcWeightB); } http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/2986c616/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/java/org/apache/guacamole/auth/mysql/MySQLGuacamoleProperties.java ---------------------------------------------------------------------- diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/java/org/apache/guacamole/auth/mysql/MySQLGuacamoleProperties.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/java/org/apache/guacamole/auth/mysql/MySQLGuacamoleProperties.java index 3c88a59..9039c02 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/java/org/apache/guacamole/auth/mysql/MySQLGuacamoleProperties.java +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/java/org/apache/guacamole/auth/mysql/MySQLGuacamoleProperties.java @@ -175,18 +175,6 @@ public class MySQLGuacamoleProperties { }; /** - * The connection weight for connections in balancing groups. - */ - public static final IntegerGuacamoleProperty - MYSQL_DEFAULT_CONNECTION_WEIGHT = - new IntegerGuacamoleProperty() { - - @Override - public String getName() { return "mysql-default-connection-weight"; } - - }; - - /** * The maximum number of concurrent connections to allow to any one * connection group by an individual user. Zero denotes * unlimited. http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/2986c616/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/java/org/apache/guacamole/auth/postgresql/PostgreSQLGuacamoleProperties.java ---------------------------------------------------------------------- diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/java/org/apache/guacamole/auth/postgresql/PostgreSQLGuacamoleProperties.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/java/org/apache/guacamole/auth/postgresql/PostgreSQLGuacamoleProperties.java index 3ae83ab..3da972f 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/java/org/apache/guacamole/auth/postgresql/PostgreSQLGuacamoleProperties.java +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/java/org/apache/guacamole/auth/postgresql/PostgreSQLGuacamoleProperties.java @@ -157,15 +157,6 @@ public class PostgreSQLGuacamoleProperties { }; - public static final IntegerGuacamoleProperty - POSTGRESQL_DEFAULT_CONNECTION_WEIGHT = - new IntegerGuacamoleProperty() { - - @Override - public String getName() { return "postgresql-default-connection-weight"; } - - }; - /** * The maximum number of concurrent connections to allow to any one * connection group. Zero denotes unlimited.