How do I achieve a while (true) like behavior with an application server?
If I need to change my persistent data every few seconds, and with each cycle, procedures A,B,C should be called:
public class Runner
{
List values;
public void repeat()
{
while (true)
{
changeSomeDataA();
changeSomeDataB();
changeSomeDataC();
}
}
}
Use @Schedule annotation for timer service of EJB. like
@Schedule(second="*/3", minute="*", hour="*")
public void automaticChangeOnTimer() {
changeSomeDataA();
changeSomeDataB();
changeSomeDataC();
logger.info("Automatic called the method");
}
For details look at following link: