diff --git a/src/main/java/org/gcube/application/framework/core/session/ASLSession.java b/src/main/java/org/gcube/application/framework/core/session/ASLSession.java index c827ce3..edafb8f 100644 --- a/src/main/java/org/gcube/application/framework/core/session/ASLSession.java +++ b/src/main/java/org/gcube/application/framework/core/session/ASLSession.java @@ -52,6 +52,8 @@ public class ASLSession{ private String avatarId; private GenderType gender; + private long sessionTimeout = -1; //if < 0, not set + /** The logger. */ private static final Logger logger = LoggerFactory.getLogger(ASLSession.class); @@ -90,8 +92,12 @@ public class ASLSession{ * @throws IOException * @throws ParserConfigurationException */ - public int getSessionTimeoutMillis() throws IOException, ParserConfigurationException { - int timeoutSecs; + public long getSessionTimeoutMillis() throws IOException, ParserConfigurationException { + if(sessionTimeout > 0){ //means that is already set to a value ! + logger.info("Session timeout already known to be: " + sessionTimeout); + return sessionTimeout; + } + int timeoutSecs; DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = null; try { @@ -136,7 +142,9 @@ public class ASLSession{ } } //At this point, in all cases "timeoutSecs" will have a valid timeout value. If not from the two xml files, then a default one - return timeoutSecs * 1000; + logger.info("Session Timeout is: " + timeoutSecs*1000); + sessionTimeout = timeoutSecs * 1000; + return timeoutSecs * 1000; } @@ -146,7 +154,7 @@ public class ASLSession{ */ public boolean isValid() { - int maxTime = -1; //it will never be -1 + long maxTime = -1; //it will never be -1 try { maxTime = getSessionTimeoutMillis(); } catch (Exception e) { e.printStackTrace();} @@ -233,7 +241,7 @@ public class ASLSession{ */ public void invalidate() { - int maxTime = -1; //it will never be -1 + long maxTime = -1; //it will never be -1 try { maxTime = getSessionTimeoutMillis(); } catch (Exception e) { e.printStackTrace();}