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
This commit is contained in:
nikolas.laskaris 2013-06-27 09:18:19 +00:00
parent e77a0832c6
commit 199ac6e994
1 changed files with 13 additions and 5 deletions

View File

@ -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();}