mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUAC-919: Use minutes for timeout value.
This commit is contained in:
@@ -24,7 +24,7 @@ package org.glyptodon.guacamole.net.basic.properties;
|
||||
|
||||
import org.glyptodon.guacamole.properties.BooleanGuacamoleProperty;
|
||||
import org.glyptodon.guacamole.properties.FileGuacamoleProperty;
|
||||
import org.glyptodon.guacamole.properties.LongGuacamoleProperty;
|
||||
import org.glyptodon.guacamole.properties.IntegerGuacamoleProperty;
|
||||
|
||||
/**
|
||||
* Properties used by the default Guacamole web application.
|
||||
@@ -82,9 +82,9 @@ public class BasicGuacamoleProperties {
|
||||
};
|
||||
|
||||
/**
|
||||
* The session timeout for the API, in milliseconds.
|
||||
* The session timeout for the API, in minutes.
|
||||
*/
|
||||
public static final LongGuacamoleProperty API_SESSION_TIMEOUT = new LongGuacamoleProperty() {
|
||||
public static final IntegerGuacamoleProperty API_SESSION_TIMEOUT = new IntegerGuacamoleProperty() {
|
||||
|
||||
@Override
|
||||
public String getName() { return "api-session-timeout"; }
|
||||
|
@@ -65,20 +65,21 @@ public class BasicTokenSessionMap implements TokenSessionMap {
|
||||
*/
|
||||
public BasicTokenSessionMap() {
|
||||
|
||||
long sessionTimeoutValue;
|
||||
int sessionTimeoutValue;
|
||||
|
||||
// Read session timeout from guacamole.properties
|
||||
try {
|
||||
sessionTimeoutValue = GuacamoleProperties.getProperty(BasicGuacamoleProperties.API_SESSION_TIMEOUT, 3600000l);
|
||||
sessionTimeoutValue = GuacamoleProperties.getProperty(BasicGuacamoleProperties.API_SESSION_TIMEOUT, 60);
|
||||
}
|
||||
catch (GuacamoleException e) {
|
||||
logger.error("Unable to read guacamole.properties: {}", e.getMessage());
|
||||
logger.debug("Error while reading session timeout value.", e);
|
||||
sessionTimeoutValue = 3600000l;
|
||||
sessionTimeoutValue = 60;
|
||||
}
|
||||
|
||||
// Check for expired sessions every minute
|
||||
executor.scheduleAtFixedRate(new SessionEvictionTask(sessionTimeoutValue), 1, 1, TimeUnit.MINUTES);
|
||||
logger.info("Sessions will expire after {} minutes of inactivity.", sessionTimeoutValue);
|
||||
executor.scheduleAtFixedRate(new SessionEvictionTask(sessionTimeoutValue * 60000l), 1, 1, TimeUnit.MINUTES);
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user