0 Replies Latest reply on Jan 16, 2009 1:09 PM by Jay McMeans

    What to use when simple Thread neededd

    Jay McMeans Newbie

      I am very new to this JBoss / J2EE stuff. But I know Java inside and out. We are creating a system that allows users to manage some telecom equipment. We doing this using JBoss 4.2 and Seam 1.2.

      I have a legacy system that I have to constantly poll to retrieve information. I need something that will constantly run so that I can regularly scrape information from it and store the results. It needs to do this process 24x7 regardless of whether someone is interacting with the system or not.

      In a normal Java application I would simply create a Thread and just scrape away. I have created a bean that has a scope of Application and has the @Startup annotation. That way it starts up when JBoss creates stuff. Inside the method associated with the @Create annotation I am spinning up a Thread and doing all of the scrapping work. This thread runs the whole time JBoss is alive. I also shut the thread down in the method associated with @Destroy.

      I have been told that I really should not create my own thread from within a Managed Bean. If that is the case then what is the best way to have something constantly running and gathering data independent of everything else?

      Because of my rookiness with this stuff, any examples would be greatly appreciated.