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

@@ -50,6 +50,12 @@ public class PostgreSQLEnvironment extends JDBCEnvironment {
*/
private static final int DEFAULT_PORT = 5432;
/**
* 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
@@ -163,6 +169,13 @@ public class PostgreSQLEnvironment extends JDBCEnvironment {
}
@Override
public int getAbsoluteMaxConnections() throws GuacamoleException {
return getProperty(PostgreSQLGuacamoleProperties.POSTGRESQL_ABSOLUTE_MAX_CONNECTIONS,
ABSOLUTE_MAX_CONNECTIONS
);
}
@Override
public int getDefaultMaxConnections() throws GuacamoleException {
return getProperty(

View File

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