fst
fst

Reputation: 23

User thread spawning in Jetty

I have a web application running over Jetty, and I need to spawn a thread for idle connection handling. This thread is being started in the spring context.

I know it's not a good practice to spawn threads in a container, but couldn't find a better way to do this. Any ideas?

Upvotes: 2

Views: 714

Answers (2)

The traditional way to handle such resources is in a servlet context listener. Check the Servlet API.

Upvotes: 1

Aaron Novstrup
Aaron Novstrup

Reputation: 21017

You can have the container set up a timer or thread pool for you. See the docs.

Upvotes: 1

Related Questions