GUAC-1512: Add absolute connection limit properties for MySQL/PostgreSQL.

This commit is contained in:
Michael Jumper
2016-03-17 00:51:29 -07:00
parent b0d890d0ac
commit 0a95e16151
6 changed files with 129 additions and 0 deletions

View File

@@ -51,6 +51,12 @@ public class MySQLEnvironment extends JDBCEnvironment {
*/
private static final int DEFAULT_PORT = 3306;
/**
* The default value for the maximum number of connections to be
* allowed to the Guacamole server overall.
*/
private final int ABSOLUTE_MAX_CONNECTIONS = 0;
/**
* The default value for the default maximum number of connections to be
* allowed per user to any one connection. Note that, as long as the
@@ -164,6 +170,13 @@ public class MySQLEnvironment extends JDBCEnvironment {
}
@Override
public int getAbsoluteMaxConnections() throws GuacamoleException {
return getProperty(MySQLGuacamoleProperties.MYSQL_ABSOLUTE_MAX_CONNECTIONS,
ABSOLUTE_MAX_CONNECTIONS
);
}
@Override
public int getDefaultMaxConnections() throws GuacamoleException {
return getProperty(

View File

@@ -115,6 +115,19 @@ public class MySQLGuacamoleProperties {
};
/**
* The maximum number of concurrent connections to allow overall. Zero
* denotes unlimited.
*/
public static final IntegerGuacamoleProperty
MYSQL_ABSOLUTE_MAX_CONNECTIONS =
new IntegerGuacamoleProperty() {
@Override
public String getName() { return "mysql-absolute-max-connections"; }
};
/**
* The maximum number of concurrent connections to allow to any one
* connection. Zero denotes unlimited.