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:
parent
e77a0832c6
commit
199ac6e994
|
@ -52,6 +52,8 @@ public class ASLSession{
|
||||||
private String avatarId;
|
private String avatarId;
|
||||||
private GenderType gender;
|
private GenderType gender;
|
||||||
|
|
||||||
|
private long sessionTimeout = -1; //if < 0, not set
|
||||||
|
|
||||||
/** The logger. */
|
/** The logger. */
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ASLSession.class);
|
private static final Logger logger = LoggerFactory.getLogger(ASLSession.class);
|
||||||
|
|
||||||
|
@ -90,8 +92,12 @@ public class ASLSession{
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws ParserConfigurationException
|
* @throws ParserConfigurationException
|
||||||
*/
|
*/
|
||||||
public int getSessionTimeoutMillis() throws IOException, ParserConfigurationException {
|
public long getSessionTimeoutMillis() throws IOException, ParserConfigurationException {
|
||||||
int timeoutSecs;
|
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();
|
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
|
||||||
DocumentBuilder dBuilder = null;
|
DocumentBuilder dBuilder = null;
|
||||||
try {
|
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
|
//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()
|
public boolean isValid()
|
||||||
{
|
{
|
||||||
int maxTime = -1; //it will never be -1
|
long maxTime = -1; //it will never be -1
|
||||||
try {
|
try {
|
||||||
maxTime = getSessionTimeoutMillis();
|
maxTime = getSessionTimeoutMillis();
|
||||||
} catch (Exception e) { e.printStackTrace();}
|
} catch (Exception e) { e.printStackTrace();}
|
||||||
|
@ -233,7 +241,7 @@ public class ASLSession{
|
||||||
*/
|
*/
|
||||||
public void invalidate()
|
public void invalidate()
|
||||||
{
|
{
|
||||||
int maxTime = -1; //it will never be -1
|
long maxTime = -1; //it will never be -1
|
||||||
try {
|
try {
|
||||||
maxTime = getSessionTimeoutMillis();
|
maxTime = getSessionTimeoutMillis();
|
||||||
} catch (Exception e) { e.printStackTrace();}
|
} catch (Exception e) { e.printStackTrace();}
|
||||||
|
|
Loading…
Reference in New Issue