455476 MongoSessionManager sessions always expire at create + maxIdle
This commit is contained in:
parent
89a9aa2472
commit
5e8e0b11f5
|
@ -259,6 +259,7 @@ public class MongoSessionIdManager extends AbstractSessionIdManager
|
|||
*/
|
||||
protected void purge()
|
||||
{
|
||||
__log.debug("PURGING");
|
||||
BasicDBObject invalidQuery = new BasicDBObject();
|
||||
|
||||
invalidQuery.put(MongoSessionManager.__ACCESSED, new BasicDBObject("$lt",System.currentTimeMillis() - _purgeInvalidAge));
|
||||
|
@ -432,6 +433,8 @@ public class MongoSessionIdManager extends AbstractSessionIdManager
|
|||
|
||||
_scavengerTask = _scheduler.schedule(new Scavenger(), _scavengePeriod, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
else if (__log.isDebugEnabled())
|
||||
__log.debug("Scavenger disabled");
|
||||
|
||||
|
||||
//if purging is enabled, setup the purge thread
|
||||
|
@ -444,6 +447,8 @@ public class MongoSessionIdManager extends AbstractSessionIdManager
|
|||
}
|
||||
_purgerTask = _scheduler.schedule(new Purger(), _purgeDelay, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
else if (__log.isDebugEnabled())
|
||||
__log.debug("Purger disabled");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,8 @@ import com.mongodb.BasicDBObject;
|
|||
import com.mongodb.DBCollection;
|
||||
import com.mongodb.DBObject;
|
||||
import com.mongodb.MongoException;
|
||||
import com.mongodb.WriteConcern;
|
||||
import com.mongodb.WriteResult;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -268,7 +270,7 @@ public class MongoSessionManager extends NoSqlSessionManager
|
|||
Long currentExpiry = (Long)o.get(__EXPIRY);
|
||||
if (currentMaxIdle != null && getMaxInactiveInterval() > 0 && getMaxInactiveInterval() < currentMaxIdle)
|
||||
sets.put(__MAX_IDLE, getMaxInactiveInterval());
|
||||
if (currentExpiry != null && expiry > 0 && expiry < currentExpiry)
|
||||
if (currentExpiry != null && expiry > 0 && expiry != currentExpiry)
|
||||
sets.put(__EXPIRY, currentExpiry);
|
||||
}
|
||||
}
|
||||
|
@ -302,8 +304,10 @@ public class MongoSessionManager extends NoSqlSessionManager
|
|||
if (!unsets.isEmpty())
|
||||
update.put("$unset",unsets);
|
||||
|
||||
_dbSessions.update(key,update,upsert,false);
|
||||
__log.debug("MongoSessionManager:save:db.sessions.update( {}, {}, true) ", key, update);
|
||||
_dbSessions.update(key,update,upsert,false,WriteConcern.SAFE);
|
||||
|
||||
if (__log.isDebugEnabled())
|
||||
__log.debug("MongoSessionManager:save:db.sessions.update( {}, {} )", key, update);
|
||||
|
||||
if (activateAfterSave)
|
||||
session.didActivate();
|
||||
|
@ -421,7 +425,7 @@ public class MongoSessionManager extends NoSqlSessionManager
|
|||
update.put("$set",sets);
|
||||
}
|
||||
|
||||
_dbSessions.update(key,update,false,false);
|
||||
_dbSessions.update(key,update,false,false,WriteConcern.SAFE);
|
||||
|
||||
session.didActivate();
|
||||
|
||||
|
@ -520,7 +524,7 @@ public class MongoSessionManager extends NoSqlSessionManager
|
|||
BasicDBObject unsets = new BasicDBObject();
|
||||
unsets.put(getContextKey(),1);
|
||||
remove.put("$unset",unsets);
|
||||
_dbSessions.update(key,remove);
|
||||
_dbSessions.update(key,remove,false,false,WriteConcern.SAFE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -556,7 +560,7 @@ public class MongoSessionManager extends NoSqlSessionManager
|
|||
update.put("$set",sets);
|
||||
|
||||
BasicDBObject key = new BasicDBObject(__ID,idInCluster);
|
||||
_dbSessions.update(key,update);
|
||||
_dbSessions.update(key,update,false,false,WriteConcern.SAFE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -573,7 +577,7 @@ public class MongoSessionManager extends NoSqlSessionManager
|
|||
BasicDBObject sets = new BasicDBObject();
|
||||
BasicDBObject update = new BasicDBObject(__ID, newClusterId);
|
||||
sets.put("$set", update);
|
||||
_dbSessions.update(key, sets, false, false);
|
||||
_dbSessions.update(key, sets, false, false,WriteConcern.SAFE);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------ */
|
||||
|
|
Loading…
Reference in New Issue