From 199ac6e9948ea07bf33278d723756c119eb267ea Mon Sep 17 00:00:00 2001 From: "nikolas.laskaris" Date: Thu, 27 Jun 2013 09:18:19 +0000 Subject: [PATCH] Added the sessionTimeout variable to hold the session timeout since it's found within the files! git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerCore@77343 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../framework/core/session/ASLSession.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) 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();}