java - Single background thread in an EJB3.0 container -


we have need run housekeeping thread in ejb3.0 container. have "timerservice" @stateless ejb (necessary because has has other @ejbs injected), creates interval ejb timer when it's starttimer() method called. there should 1 instance of timer thread. current solution involves calling starttimer() init() method of 1 of our servlets, servlet forced load @ startup using in web.xml, feels coincidental behaviour instead of right way things. we've had problem because else subclassed servlet, meant init() called twice, meant 2 timer threads.

this feels it's not unusual requirement, what's proper way this, if anything? seems me there ought simple way ask container start thread when starts up, without having tie other resources in container.

for ejb < 3.1 going have application server specific or hackish. since mention using jboss, can use @management tag has defined lifecycle methods.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -