mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
GUACAMOLE-102: Clean up code style issues, remove the unnecessary getDefaultConnectionWeight method.
This commit is contained in:
@@ -82,17 +82,6 @@ public abstract class JDBCEnvironment extends LocalEnvironment {
|
|||||||
*/
|
*/
|
||||||
public abstract int getDefaultMaxConnections() throws GuacamoleException;
|
public abstract int getDefaultMaxConnections() throws GuacamoleException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the connection weight for the purpose of WRR calculation
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* The weight of the connection.
|
|
||||||
*
|
|
||||||
* @throws GuacamoleException
|
|
||||||
* If an error occurs while retrieving the property.
|
|
||||||
*/
|
|
||||||
public abstract int getDefaultConnectionWeight() throws GuacamoleException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the default maximum number of concurrent connections to allow to
|
* Returns the default maximum number of concurrent connections to allow to
|
||||||
* any one connection group, unless specified differently on an individual
|
* any one connection group, unless specified differently on an individual
|
||||||
|
@@ -417,12 +417,11 @@ public class ModeledConnection extends ModeledChildDirectoryObject<ConnectionMod
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* The weight of the connection.
|
* The weight of the connection.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public int getConnectionWeight() {
|
public int getConnectionWeight() {
|
||||||
|
|
||||||
Integer connectionWeight = getModel().getConnectionWeight();
|
Integer connectionWeight = getModel().getConnectionWeight();
|
||||||
if(connectionWeight == null)
|
if (connectionWeight == null)
|
||||||
return 1;
|
return 1;
|
||||||
return connectionWeight;
|
return connectionWeight;
|
||||||
|
|
||||||
|
@@ -188,7 +188,7 @@ public class RestrictedGuacamoleTunnelService
|
|||||||
public int compare(ModeledConnection a, ModeledConnection b) {
|
public int compare(ModeledConnection a, ModeledConnection b) {
|
||||||
|
|
||||||
return ((getActiveConnections(a).size() + 1) * b.getConnectionWeight() -
|
return ((getActiveConnections(a).size() + 1) * b.getConnectionWeight() -
|
||||||
(getActiveConnections(b).size() + 1) * a.getConnectionWeight());
|
(getActiveConnections(b).size() + 1) * a.getConnectionWeight());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,7 +202,7 @@ public class RestrictedGuacamoleTunnelService
|
|||||||
|
|
||||||
// If connection weight is zero or negative, this host is disabled and should not be used.
|
// If connection weight is zero or negative, this host is disabled and should not be used.
|
||||||
if (connection.getConnectionWeight() < 1) {
|
if (connection.getConnectionWeight() < 1) {
|
||||||
logger.warn("Weight for {} is < 1, connection will be skipped.", connection.getName());
|
logger.debug("Weight for {} is < 1, connection will be skipped.", connection.getName());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -200,14 +200,6 @@ public class MySQLEnvironment extends JDBCEnvironment {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getDefaultConnectionWeight() throws GuacamoleException {
|
|
||||||
return getProperty(
|
|
||||||
MySQLGuacamoleProperties.MYSQL_DEFAULT_CONNECTION_WEIGHT,
|
|
||||||
DEFAULT_CONNECTION_WEIGHT
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDefaultMaxGroupConnections() throws GuacamoleException {
|
public int getDefaultMaxGroupConnections() throws GuacamoleException {
|
||||||
return getProperty(
|
return getProperty(
|
||||||
|
@@ -200,14 +200,6 @@ public class PostgreSQLEnvironment extends JDBCEnvironment {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getDefaultConnectionWeight() throws GuacamoleException {
|
|
||||||
return getProperty(
|
|
||||||
PostgreSQLGuacamoleProperties.POSTGRESQL_DEFAULT_CONNECTION_WEIGHT,
|
|
||||||
DEFAULT_CONNECTION_WEIGHT
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDefaultMaxGroupConnections() throws GuacamoleException {
|
public int getDefaultMaxGroupConnections() throws GuacamoleException {
|
||||||
return getProperty(
|
return getProperty(
|
||||||
|
Reference in New Issue
Block a user