int timeIdle = // Truncate, do not round up
(int) ((timeNow - session.getThisAccessedTime()) / 1000L);
if (timeIdle > maxIdleSwap && timeIdle > minIdleSwap) {
- if (sessions[i] instanceof StandardSession) {
- if (((StandardSession) sessions[i]).accessCount.get() > 0) {
- // Session is currently being accessed - skip it
- continue;
- }
- }
+ if (session.accessCount != null &&
+ session.accessCount.get() > 0) {
+ // Session is currently being accessed - skip it
+ continue;
+ }
if (log.isDebugEnabled())
log.debug(sm.getString
("persistentManager.swapMaxIdle",
long timeNow = System.currentTimeMillis();
for (int i = 0; i < sessions.length && toswap > 0; i++) {
- synchronized (sessions[i]) {
+ StandardSession session = (StandardSession) sessions[i];
+ synchronized (session) {
int timeIdle = // Truncate, do not round up
- (int) ((timeNow - sessions[i].getThisAccessedTime()) / 1000L);
+ (int) ((timeNow - session.getThisAccessedTime()) / 1000L);
if (timeIdle > minIdleSwap) {
- if (sessions[i] instanceof StandardSession) {
- if (((StandardSession) sessions[i]).accessCount.get() > 0) {
- // Session is currently being accessed - skip it
- continue;
- }
+ if (session.accessCount != null &&
+ session.accessCount.get() > 0) {
+ // Session is currently being accessed - skip it
+ continue;
}
if(log.isDebugEnabled())
log.debug(sm.getString
("persistentManager.swapTooManyActive",
- sessions[i].getIdInternal(), new Integer(timeIdle)));
+ session.getIdInternal(), new Integer(timeIdle)));
try {
- swapOut(sessions[i]);
+ swapOut(session);
} catch (IOException e) {
// This is logged in writeSession()
}
has not been thoroughly tested, and should be considered experimental!
</strong></em></p>
+ <p><strong>NOTE:</strong> You must set either the
+ <code>org.apache.catalina.session.StandardSession.ACTIVITY_CHECK</code> or
+ <code>org.apache.catalina.STRICT_SERVLET_COMPLIANCE</code>
+ <a href="systemprops.html">system properties</a> to <code>true</code> for
+ the persistent manager to work correctly.</p>
+
<p>The persistent implementation of <strong>Manager</strong> is
<strong>org.apache.catalina.session.PersistentManager</strong>. In
addition to the usual operations of creating and deleting sessions, a