guacamole-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mjum...@apache.org
Subject [04/28] incubator-guacamole-client git commit: GUACAMOLE-102: Tweak algorithm for computing the WLC vlaues.
Date Wed, 07 Jun 2017 00:32:24 GMT
GUACAMOLE-102: Tweak algorithm for computing the WLC vlaues.


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/83a8e822
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/83a8e822
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/83a8e822

Branch: refs/heads/master
Commit: 83a8e8223e9453f3928963f0cf1d901de182ac44
Parents: d0647ad
Author: Nick Couchman <vnick@apache.org>
Authored: Mon Mar 20 09:06:04 2017 -0400
Committer: Nick Couchman <nick.couchman@yahoo.com>
Committed: Mon Jun 5 15:34:21 2017 -0400

----------------------------------------------------------------------
 .../auth/jdbc/connection/ModeledConnection.java   | 13 +++----------
 .../tunnel/RestrictedGuacamoleTunnelService.java  | 18 +++++-------------
 2 files changed, 8 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/83a8e822/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ModeledConnection.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ModeledConnection.java
b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ModeledConnection.java
index aa79ba4..1044a62 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ModeledConnection.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ModeledConnection.java
@@ -416,19 +416,12 @@ public class ModeledConnection extends ModeledChildDirectoryObject<ConnectionMod
      * @return
      *     The weight of the connection.
      *  
-     * @throws GuacamoleException
-     *     If an error occurs while parsing the concurrency limit properties
-     *     specified within guacamole.properties.
      */
-    public int getConnectionWeight() throws GuacamoleException {
+    public int getConnectionWeight() {
 
-        // Pull default from environment if weight is unset
-        Integer value = getModel().getConnectionWeight();
-        if (value == null)
-            return environment.getDefaultConnectionWeight();
+        // Return the connection weight
+        return getModel().getConnectionWeight();
 
-        // Otherwise use defined value
-        return value;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/83a8e822/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 92cdfc6..ae7a059 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
@@ -192,21 +192,13 @@ public class RestrictedGuacamoleTunnelService
                 
                 logger.trace("Comparing {} to {}.", a.getName(), b.getName());
                 int cw = 0;
+                int weightA = a.getConnectionWeight();
+                int weightB = b.getConnectionWeight();
+                int connsA = getActiveConnections(a).size();
+                int connsB = getActiveConnections(b).size();
 
-                try {
-                    if(a.getConnectionWeight() > 0 && b.getConnectionWeight()
> 0)
-                        cw = (int)(a.getConnectionWeight()/getActiveConnections(a).size()
- b.getConnectionWeight()/getActiveConnections(b).size());
-                    else
-                        cw = getActiveConnections(a).size() - getActiveConnections(b).size();
+                return (connsA * 10000 / weightA) - (connsB * 10000 / weightB);
 
-                }
-                catch (GuacamoleException e) {
-                    logger.error("Could not compare connections.", e.getMessage());
-                    logger.debug("Could not compare connections.", e);
-                }
-
-                return cw;
-            
             }
 
         });


Mime
View raw message