GUACAMOLE-102: Clean up code style issues, remove the unnecessary getDefaultConnectionWeight method.

This commit is contained in:
Nick Couchman
2017-06-05 15:13:19 -04:00
parent f66bbd2e0f
commit d2d543028f
5 changed files with 3 additions and 31 deletions

View File

@@ -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

View File

@@ -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;

View File

@@ -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;
} }

View File

@@ -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(

View File

@@ -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(