Hi, I have to implement a process that always keeps running in background, forever. I want to know if the way I'm implementing it is the most "seamish" way to do it. The process will have to access an EntityManager:
@Name("messageReceiver")
@Scope(ScopeType.APPLICATION)
@Startup
public class MessageReceiver implements Runnable {
private Thread thread;
public MessageReceiver() {
thread = new Thread(this);
thread.run();
}
@Override
public void run() {
// do my stuff forever
}
}
It is not important for this question I think, but if it matters, I want to implement a JMS receiver (I dont like te way Seam JMS module is implemented because it uses polling, and I want an always living connection for better time responses).
Thanks a lot!!