How to make @Schedule method to be called only once at a time
问题 We are using the @Schedule EJB annotation to start a scheduled job do a delta SOLR import every x seconds. Of course we want to have as less timeshift in indexing as possible. Currently I try to do the delta every 5 seconds. So my question is: Can I make sure the job is only called once? So let's say the indexing is lasting longer than 5 seconds, will the next schedules call wait until the previous is coming back? 回答1: Yes. You can make the bean a @Singleton and use @Lock(LockType.Write) to