435412 Make AbstractSession.access() more amenable to customization

This commit is contained in:
Jan Bartel 2014-05-21 18:41:36 +02:00
parent 65e13ce08f
commit 58ea1dd386
1 changed files with 13 additions and 1 deletions

View File

@ -110,6 +110,18 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI
throw new IllegalStateException(); throw new IllegalStateException();
} }
/* ------------------------------------------------------------- */
/** Check to see if session has expired as at the time given.
* @param time
* @return
*/
protected boolean checkExpiry(long time)
{
if (_maxIdleMs>0 && _lastAccessed>0 && _lastAccessed + _maxIdleMs < time)
return true;
return false;
}
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
@Override @Override
public AbstractSession getSession() public AbstractSession getSession()
@ -317,7 +329,7 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI
_lastAccessed=_accessed; _lastAccessed=_accessed;
_accessed=time; _accessed=time;
if (_maxIdleMs>0 && _lastAccessed>0 && _lastAccessed + _maxIdleMs < time) if (checkExpiry(time))
{ {
invalidate(); invalidate();
return false; return false;