Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Olivier Lamy <olamy@apache.org>
  • Loading branch information
olamy committed Aug 27, 2024
1 parent af7657a commit a3c7c04
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

import java.io.IOException;
import java.io.PrintWriter;
import java.time.Duration;

import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
Expand Down Expand Up @@ -97,7 +96,6 @@ public void testAttributeNamesWithDots() throws Exception
{

HttpClient client = new HttpClient();
client.setIdleTimeout(Duration.ofSeconds(100000).toMillis());
client.start();
try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,6 @@ public boolean delete(String id) throws Exception
@Override
public boolean doExists(String id) throws Exception
{
// DBObject fields = new BasicDBObject();
// fields.put(__EXPIRY, 1);
// fields.put(__VALID, 1);
// fields.put(getContextSubfield(__VERSION), 1);

Bson projection = Projections.fields(Projections.include(__ID, __VALID, __EXPIRY, __VERSION, getContextField()), Projections.excludeId());
Bson filterId = Filters.eq(__ID, id);
Document sessionDocument = _dbSessions.find(filterId).projection(projection).first();
Expand All @@ -342,7 +337,7 @@ public boolean doExists(String id) throws Exception
Long expiry = (Long)sessionDocument.get(__EXPIRY);

//expired?
if (expiry > 0 && expiry < System.currentTimeMillis())
if (expiry != null && expiry > 0 && expiry < System.currentTimeMillis())
return false; //it's expired

//does it exist for this context?
Expand Down Expand Up @@ -404,28 +399,6 @@ public Set<String> doGetExpired(long timeLimit)
Set<String> expiredSessions = StreamSupport.stream(documents.spliterator(), false)
.map(document -> document.getString(__ID))
.collect(Collectors.toSet());
//
// DBCursor oldExpiredSessions = null;
// try
// {
// BasicDBObject bo = new BasicDBObject(__ID, 1);
// bo.append(__EXPIRY, 1);
//
// oldExpiredSessions = _dbSessions.find(query, bo);
// for (DBObject session : oldExpiredSessions)
// {
// String id = (String)session.get(__ID);
//
//
// expiredSessions.add(id);
// }
// }
// finally
// {
// if (oldExpiredSessions != null)
// oldExpiredSessions.close();
// }

return expiredSessions;
}

Expand Down

0 comments on commit a3c7c04

Please sign in to comment.