Search code examples
javatomcatjakarta-eemultithreadingdaemon

Threads in a Java EE application


I have a Java EE application that has two components: First is a service that scrapes some information from internet and fills it into database. Second is a web interface (deployed on tomcat) from where user can browse that information.

What could be the best approach to implement the first component? Should it be run as a background Daemon/Service or a thread within the container?


Solution

  • I would personally separate them into different processes. Aside from anything else, it means you can restart one without worrying about the other. It also means you can really easily deploy them on different machines without pointlessly installing Tomcat for a service which doesn't actually need a web interface.