Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-dev] Session Management with Redis

Hi Jan,


I’m not trying to build Mongo session management, I’m looking at the code to figure out how I should implement Redis session management. I’m using Dropwizard 1.0.0, which uses jetty 9.3 ( Once I’ve got my working solution I’m happy to donate it and port it to 9.4, but I need 9.3 for now. also seems to think that this is the production version.






Van: jetty-dev-bounces@xxxxxxxxxxx [mailto:jetty-dev-bounces@xxxxxxxxxxx] Namens Jan Bartel
Verzonden: woensdag 21 september 2016 02:07
Aan: Jetty @ Eclipse developer discussion list <jetty-dev@xxxxxxxxxxx>
Onderwerp: Re: [jetty-dev] Session Management with Redis


Hi Friso,

Any chance you could build your own mongo session management for jetty-9.4?  We have totally re-architected sessions and made it much, much cleaner, clearer and easier to implement for different technologies? I really really recommend you go that way if you possibly can.

I'd be interested to know your motivation for rolling-your-own mongo session management? Always keen to know if there is some functionality that we should be providing in the standard jetty release that would be helpful to the greatest number of users ....


Looks to me like you've found some funnies in the mongo code around line 420: seems weird that we remove the attribute, and then call the http session value unbinding listener with a null value. Also undesirable that there is the side-effect of saving the session in doPutOrRemove: if more than 1 attribute had been removed from the session, the first iteration around would promptly write back in the other attributes!  I would remove all of the attributes from the session, remembering their values and then call the http session unbinding listeners but forego calling at all.

For these kind of reasons, I strongly recommend basing your impl of jetty-9.4 instead.




On 20 September 2016 at 22:33, Friso Vrolijken <friso.vrolijken@xxxxxxxxxxxxx> wrote:

Hi all,


I want to use Redis as a backing for my sessions. I’ve seen, but the five years since any commit doesn’t inspire much confidence. I’ve also seen, but was unable to find the fruits of Denis’ labour.


So I’m currently making a NoSqlSessionManager extension based on Redis. For this I’m looking at the Mongo implementation and trying to stay close to it. Doing that I struck some code I don’t understand. Hopefully somebody here can enlighten me?


In org.eclipse.jetty.nosql.mongodb.MongoSessionManager.refresh(NoSqlSession, Object), which as I understand exists to update a session in memory from a session on disk, session.doPutOrRemove(attr,value) is called (l. 406). If the manager’s savePeriod is -2, that results in a, which is used to update a session on disk from memory. This does not look right to me, but I might (very well) be mistaken. Any clues?


A little further on in the same method (l. 420) this sequence is called:



I think the second call is equivalent to session.unbindValue(str, session.getAttribute(str));, but I’m not sure that that is what the authors meant. Can I do that or should it be:

                        Object o = session.getAttribute(str);

                        session.doPutOrRemove(str,null); // might also result in a save



Any help is appreciated,






jetty-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit


Jan Bartel <janb@xxxxxxxxxxx>
Expert assistance from the creators of Jetty and CometD


Back to the top