Reputation: 23
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
Reputation: 75426
The traditional way to handle such resources is in a servlet context listener. Check the Servlet API.
Upvotes: 1
Reputation: 21017
You can have the container set up a timer or thread pool for you. See the docs.
Upvotes: 1