i have a method which needs to be executed at a specific time. I use @Schedule annotation to achieve this. When the method is executed it sends an email. The schedule works and the mail is sent at the time i want but it is sent twice so the method is somehow executed twice. Here is my code:
@Singleton
public class ScheduledClass{
@EJB
private SomeService someService;
@Schedule(hour = "17", minute = "10", persistent = false)
public void scheduledMethod(){
try{
//here i send the mail
}
}
}
I'm not sure if this executed twice thing is happening because of the Singleton annotation. Can someone help?