title: How to run a process continuously in Jakarta / Java EE (without website requests)?
body: <p>In my Jakarta/Java EE (Tomcat) project I need to connect to a Serial device and communicate with it. To achieve this, I have to open the connection on server startup. From this point on, I can run part of the program (like different thread) continuously for communication purpose. This part of the program should therefore run independently of user requests, but it has to be able to access the communication part.</p>
  <p>As a possible solution I have read that I could use the default main method, but in my case, it does not get executed.</p>
  <p>[I can’t use two separate programs (one SE and one EE) because I need to access the variables/Objects.]</p>
  <p>So, how to safely execute a function that can run continuously on server startup? (Please provide an example)</p>