I am using an EJB automatic timer service with @schedule annotation. However I need help with the following.
I need a singleton time service (execution on only one node in a cluster) but don't want to execute missed timers during server restart or crash.
I read many articles but everyone is mentioning about persistent timers to achieve the singleton behavior in a cluster environment.
My code:
@Singleton
@Startup
public class DataService {
@Schedule(second="*/10", minute="*", hour="*", persistent=false)
public void xxxFetch() {
// business logic
}
}
Is there a way to achieve Singleton service with non-persistent timers?