J_D
J_D

Reputation: 3596

Jetty HashSessionManager

I am using Jetty 9 (Embedded) as a Web server, but I am not using Jetty sessions nor its session manager.

When I launch my server, I notice that 2 threads are automatically created with the name org.eclipse.jetty.server.session.HashSessionManager.

From the documentation this is how Jetty manages sessions, removed the timed out sessions and even synchronizing with an external DB if session sharing is enabled.

Since I am not using Jetty's session management, is there any way I can disable this HashSessionManager? (I did read the documentation but either it was not documented or I managed to miss the part describing how to turn it off!)

Thanks

Upvotes: 0

Views: 1029

Answers (1)

J_D
J_D

Reputation: 3596

Answering my own question in case someone else blindly copies-pastes the documentation example!

In the documentation about embedding Jetty (http://www.eclipse.org/jetty/documentation/current/embedding-jetty.html), they create the ServlerContextHandler with the SESSION management flag:

ServletContextHandler context = new ServletContextHandler(
                ServletContextHandler.SESSIONS);

By simply removing ServletContextHandler.SESSIONS, the HashSessionManager thread disappears.

That will teach me to understand code and not just copy-pasting the examples!

Upvotes: 2

Related Questions