From 23f11017d329d0271cbe98a9dcf76960387f1f31 Mon Sep 17 00:00:00 2001 From: Tilo Zemke Date: Mon, 7 Nov 2016 17:54:04 +0100 Subject: [PATCH 1/2] Fix for MongoSessionIdManager's scavenging of immortal sessions Signed-off-by: Tilo Zemke --- .../org/eclipse/jetty/nosql/mongodb/MongoSessionIdManager.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionIdManager.java b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionIdManager.java index 18323639d89..bf5d3562141 100644 --- a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionIdManager.java +++ b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionIdManager.java @@ -268,8 +268,7 @@ public class MongoSessionIdManager extends AbstractSessionIdManager BasicDBObject query = new BasicDBObject(); query.put(MongoSessionManager.__ID,new BasicDBObject("$in", ids )); - query.put(MongoSessionManager.__EXPIRY, new BasicDBObject("$gt", 0)); - query.put(MongoSessionManager.__EXPIRY, new BasicDBObject("$lt", atTime)); + query.put(MongoSessionManager.__EXPIRY, new BasicDBObject("$gt", 0).append("$lt", atTime)); DBCursor checkSessions = _sessions.find(query, new BasicDBObject(MongoSessionManager.__ID, 1)); From c499ec68f7d824fea420b10b504fbfedc7b94b0b Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Wed, 9 Nov 2016 10:42:44 +1100 Subject: [PATCH 2/2] Issue #1020 Add test for immortal session for mongo --- .../nosql/mongodb/ImmortalSessionTest.java | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ImmortalSessionTest.java diff --git a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ImmortalSessionTest.java b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ImmortalSessionTest.java new file mode 100644 index 00000000000..f3c001e0d49 --- /dev/null +++ b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ImmortalSessionTest.java @@ -0,0 +1,42 @@ +// +// ======================================================================== +// Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + + +package org.eclipse.jetty.nosql.mongodb; + +import org.eclipse.jetty.server.session.AbstractImmortalSessionTest; +import org.eclipse.jetty.server.session.AbstractTestServer; + +/** + * ImmortalSessionTest + * + * + */ +public class ImmortalSessionTest extends AbstractImmortalSessionTest +{ + + /** + * @see org.eclipse.jetty.server.session.AbstractImmortalSessionTest#createServer(int, int, int) + */ + @Override + public AbstractTestServer createServer(int port, int maxInactiveMs, int scavengeMs) + { + return new MongoTestServer(port, maxInactiveMs, scavengeMs); + } + +}