Configurei um Scheduler com o JBoss 6.0 e está executando 4 vezes o método:
import java.util.Date;
import javax.ejb.Schedule;
import javax.ejb.Stateless;
/**
* Session Bean implementation class TesteCron
*/
@Stateless
public class TesteCron {
/**
* Default constructor.
*/
public TesteCron() {
// TODO Auto-generated constructor stub
}
@Schedule(second="10", persistent=false)
public void escreve(){
System.out.println("Executado: " + new Date());
}
}
O resultado da primeira execução:
17:11:20,004 INFO [STDOUT] Executado: Tue Nov 20 17:11:20 GMT-03:00 2012
17:11:20,004 INFO [STDOUT] Executado: Tue Nov 20 17:11:20 GMT-03:00 2012
17:11:20,004 INFO [STDOUT] Executado: Tue Nov 20 17:11:20 GMT-03:00 2012
17:11:20,005 INFO [STDOUT] Executado: Tue Nov 20 17:11:20 GMT-03:00 2012
17:11:20,005 INFO [STDOUT] Executado: Tue Nov 20 17:11:20 GMT-03:00 2012
17:11:20,007 INFO [STDOUT] Executado: Tue Nov 20 17:11:20 GMT-03:00 2012
Algum membro já passou por isso ?
Grato.