This commit is contained in:
Jan Bartel 2016-11-04 10:49:28 +11:00
parent 5395cfd021
commit f79d7cfe20
2 changed files with 13 additions and 4 deletions

View File

@ -232,8 +232,7 @@ public class Session implements SessionHandler.SessionIf
long lastAccessed = _sessionData.getAccessed();
_sessionData.setAccessed(time);
_sessionData.setLastAccessed(lastAccessed);
int maxInterval=getMaxInactiveInterval();
_sessionData.setExpiry(maxInterval <= 0 ? 0 : (time + maxInterval*1000L));
_sessionData.calcAndSetExpiry(time);
if (isExpiredAt(time))
{
invalidate();

View File

@ -251,6 +251,16 @@ public class SessionData implements Serializable
return (getMaxInactiveMs() <= 0 ? 0 : (System.currentTimeMillis() + getMaxInactiveMs()));
}
public long calcExpiry (long time)
{
return (getMaxInactiveMs() <= 0 ? 0 : (time + getMaxInactiveMs()));
}
public void calcAndSetExpiry (long time)
{
setExpiry(calcExpiry(time));
}
public void calcAndSetExpiry ()
{
setExpiry(calcExpiry());
@ -351,8 +361,8 @@ public class SessionData implements Serializable
public boolean isExpiredAt (long time)
{
if (LOG.isDebugEnabled())
LOG.debug("Testing expiry on session {}: expires at {} now {}", _id, getExpiry(), time);
if (getExpiry() <= 0)
LOG.debug("Testing expiry on session {}: expires at {} now {} maxIdle {}", _id, getExpiry(), time, getMaxInactiveMs());
if (getMaxInactiveMs() <= 0)
return false; //never expires
return (getExpiry() <= time);
}